# kirago-tech/laravel-routify architecture

> Architecture diagram of the GitHub repository kirago-tech/laravel-routify, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kirago-tech/laravel-routify
- Repository: https://github.com/kirago-tech/laravel-routify

## Overview

Laravel Routify discovers route files recursively, assigns them to configured stacks, then registers them with Laravel using stack middleware, prefixes, names and domains. The primary flow starts at package boot or an explicit facade call, passes through the manager and discovery layer, and registers matching files with Laravel; fluent stack customization and optional cached discovery extend that flow. Console commands expose listing and cache maintenance. The README documents glob- and folder-based discovery and HTTP, console and broadcast stacks; source excerpts do not show every configured stack or command implementation in detail.

Main entry points: [`src/RoutifyManager.php`](https://github.com/kirago-tech/laravel-routify/blob/main/src/RoutifyManager.php) (Discovery manager), [`src/RoutifyServiceProvider.php`](https://github.com/kirago-tech/laravel-routify/blob/main/src/RoutifyServiceProvider.php) (Service provider), [`src/Discovery/CachedRouteDiscoverer.php`](https://github.com/kirago-tech/laravel-routify/blob/main/src/Discovery/CachedRouteDiscoverer.php) (Cached discovery), [`src/Facades/Routify.php`](https://github.com/kirago-tech/laravel-routify/blob/main/src/Facades/Routify.php) (Routify facade)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Laravel entry points"]
  node_provider["Service provider"]
  node_facade["Routify facade<br/>[Routify.php]"]
  node_config["Package configuration<br/>[routify.php]"]
end

subgraph group_discovery["Route discovery"]
  node_discoverer["Filesystem discovery"]
  node_cachedecorator["Cached discovery"]
  node_discovercontract["Discovery contract"]
end

subgraph group_registration["Stack registration"]
  node_manager["Discovery manager<br/>[RoutifyManager.php]"]
  node_builder["Fluent stack builder"]
  node_stackconfig["Stack configuration<br/>[StackConfig.php]"]
  node_loadercontract["Stack loader contract<br/>[StackLoader.php]"]
end

subgraph group_operations["Console operations"]
  node_listcommand["List routes command<br/>[ListCommand.php]"]
  node_cachecommand["Cache command<br/>[CacheCommand.php]"]
  node_clearcommand["Clear cache command<br/>[ClearCommand.php]"]
  node_optimizecommand["Optimize command"]
end

node_app(("Laravel application"))
node_routes["Route files"]
node_router["Laravel router"]
node_cache[("Laravel cache store")]

node_app -->|"boots"| node_provider
node_provider -->|"loads defaults"| node_config
node_provider -->|"starts discovery"| node_manager
node_facade -->|"delegates to"| node_manager
node_manager -->|"creates"| node_builder
node_builder -->|"loads stack"| node_manager
node_manager -->|"builds stacks"| node_stackconfig
node_manager -->|"uses"| node_discovercontract
node_manager -.->|"resolves optionally"| node_cachedecorator
node_cachedecorator -->|"delegates scans"| node_discoverer
node_discoverer -->|"finds files"| node_routes
node_manager -->|"requires files"| node_routes
node_manager -->|"registers routes"| node_router
node_manager -->|"implements"| node_loadercontract
node_cachedecorator -->|"reads and writes"| node_cache
node_provider -->|"configures optional cache"| node_cachedecorator
node_provider -->|"registers"| node_listcommand
node_provider -->|"registers"| node_cachecommand
node_provider -->|"registers"| node_clearcommand
node_provider -->|"registers"| node_optimizecommand
node_listcommand -->|"queries files"| node_discovercontract
node_cachecommand -->|"invokes discovery"| node_facade
node_clearcommand -->|"forgets keys"| node_cache
node_optimizecommand -->|"invokes discovery"| node_facade

click node_provider "https://github.com/kirago-tech/laravel-routify/blob/main/src/RoutifyServiceProvider.php"
click node_facade "https://github.com/kirago-tech/laravel-routify/blob/main/src/Facades/Routify.php"
click node_manager "https://github.com/kirago-tech/laravel-routify/blob/main/src/RoutifyManager.php"
click node_builder "https://github.com/kirago-tech/laravel-routify/blob/main/src/Support/RouteStackBuilder.php"
click node_stackconfig "https://github.com/kirago-tech/laravel-routify/blob/main/src/Support/StackConfig.php"
click node_config "https://github.com/kirago-tech/laravel-routify/blob/main/config/routify.php"
click node_discoverer "https://github.com/kirago-tech/laravel-routify/blob/main/src/Discovery/FilesystemRouteDiscoverer.php"
click node_cachedecorator "https://github.com/kirago-tech/laravel-routify/blob/main/src/Discovery/CachedRouteDiscoverer.php"
click node_listcommand "https://github.com/kirago-tech/laravel-routify/blob/main/src/Commands/ListCommand.php"
click node_cachecommand "https://github.com/kirago-tech/laravel-routify/blob/main/src/Commands/CacheCommand.php"
click node_clearcommand "https://github.com/kirago-tech/laravel-routify/blob/main/src/Commands/ClearCommand.php"
click node_optimizecommand "https://github.com/kirago-tech/laravel-routify/blob/main/src/Commands/OptimizeCommand.php"
click node_discovercontract "https://github.com/kirago-tech/laravel-routify/blob/main/src/Contracts/RouteDiscoverer.php"
click node_loadercontract "https://github.com/kirago-tech/laravel-routify/blob/main/src/Contracts/StackLoader.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_provider,node_facade,node_config toneBlue
class node_discoverer,node_cachedecorator,node_discovercontract,node_cache toneAmber
class node_manager,node_builder,node_stackconfig,node_loadercontract,node_routes,node_router toneMint
class node_listcommand,node_cachecommand,node_clearcommand,node_optimizecommand toneRose
class node_app toneIndigo
```

## Components

### Laravel entry points

- [Service provider](https://github.com/kirago-tech/laravel-routify/blob/main/src/RoutifyServiceProvider.php): `src/RoutifyServiceProvider.php`
- [Routify facade](https://github.com/kirago-tech/laravel-routify/blob/main/src/Facades/Routify.php): `src/Facades/Routify.php`
- [Package configuration](https://github.com/kirago-tech/laravel-routify/blob/main/config/routify.php): `config/routify.php`

### Route discovery

- [Filesystem discovery](https://github.com/kirago-tech/laravel-routify/blob/main/src/Discovery/FilesystemRouteDiscoverer.php): `src/Discovery/FilesystemRouteDiscoverer.php`
- [Cached discovery](https://github.com/kirago-tech/laravel-routify/blob/main/src/Discovery/CachedRouteDiscoverer.php): `src/Discovery/CachedRouteDiscoverer.php`
- [Discovery contract](https://github.com/kirago-tech/laravel-routify/blob/main/src/Contracts/RouteDiscoverer.php): `src/Contracts/RouteDiscoverer.php`

### Stack registration

- [Discovery manager](https://github.com/kirago-tech/laravel-routify/blob/main/src/RoutifyManager.php): `src/RoutifyManager.php`
- [Fluent stack builder](https://github.com/kirago-tech/laravel-routify/blob/main/src/Support/RouteStackBuilder.php): `src/Support/RouteStackBuilder.php`
- [Stack configuration](https://github.com/kirago-tech/laravel-routify/blob/main/src/Support/StackConfig.php): `src/Support/StackConfig.php`
- [Stack loader contract](https://github.com/kirago-tech/laravel-routify/blob/main/src/Contracts/StackLoader.php): `src/Contracts/StackLoader.php`

### Console operations

- [List routes command](https://github.com/kirago-tech/laravel-routify/blob/main/src/Commands/ListCommand.php): `src/Commands/ListCommand.php`
- [Cache command](https://github.com/kirago-tech/laravel-routify/blob/main/src/Commands/CacheCommand.php): `src/Commands/CacheCommand.php`
- [Clear cache command](https://github.com/kirago-tech/laravel-routify/blob/main/src/Commands/ClearCommand.php): `src/Commands/ClearCommand.php`
- [Optimize command](https://github.com/kirago-tech/laravel-routify/blob/main/src/Commands/OptimizeCommand.php): `src/Commands/OptimizeCommand.php`

### Other components

- **Laravel application**
- **Route files**
- **Laravel router**
- **Laravel cache store**

## Connections

- Laravel application → Service provider: boots (evidence: `README.md`)
- Service provider → Package configuration: loads defaults (evidence: `src/RoutifyServiceProvider.php`)
- Service provider → Discovery manager: starts discovery (evidence: `src/RoutifyServiceProvider.php`)
- Routify facade → Discovery manager: delegates to (evidence: `src/Facades/Routify.php`)
- Discovery manager → Fluent stack builder: creates (evidence: `src/RoutifyManager.php`)
- Fluent stack builder → Discovery manager: loads stack (evidence: `src/Support/RouteStackBuilder.php`)
- Discovery manager → Stack configuration: builds stacks (evidence: `src/RoutifyManager.php`)
- Discovery manager → Discovery contract: uses (evidence: `src/RoutifyManager.php`)
- Discovery manager → Cached discovery: resolves optionally (evidence: `src/RoutifyServiceProvider.php`)
- Cached discovery → Filesystem discovery: delegates scans (evidence: `src/Discovery/CachedRouteDiscoverer.php`)
- Filesystem discovery → Route files: finds files (evidence: `README.md`)
- Discovery manager → Route files: requires files (evidence: `src/RoutifyManager.php`)
- Discovery manager → Laravel router: registers routes (evidence: `src/RoutifyManager.php`)
- Discovery manager → Stack loader contract: implements (evidence: `src/RoutifyManager.php`)
- Cached discovery → Laravel cache store: reads and writes (evidence: `src/Discovery/CachedRouteDiscoverer.php`)
- Service provider → Cached discovery: configures optional cache (evidence: `src/RoutifyServiceProvider.php`)
- Service provider → List routes command: registers (evidence: `src/RoutifyServiceProvider.php`)
- Service provider → Cache command: registers (evidence: `src/RoutifyServiceProvider.php`)
- Service provider → Clear cache command: registers (evidence: `src/RoutifyServiceProvider.php`)
- Service provider → Optimize command: registers (evidence: `src/RoutifyServiceProvider.php`)
- List routes command → Discovery contract: queries files (evidence: `src/Commands/ListCommand.php`)
- Cache command → Routify facade: invokes discovery (evidence: `src/Commands/CacheCommand.php`)
- Clear cache command → Laravel cache store: forgets keys (evidence: `src/Commands/ClearCommand.php`)
- Optimize command → Routify facade: invokes discovery (evidence: `src/Commands/OptimizeCommand.php`)
