Skip to content

Repository files navigation

Laradar

Latest Version on Packagist Total Downloads PHP Version License Laravel

Laradar automatically discovers, visualizes, and documents your Laravel application architecture - without writing a single line of configuration.

Drop it into any Laravel project and instantly get an interactive dashboard that maps your models, controllers, routes, migrations, jobs, events, services, and more. Optionally enhance it with AI-powered architecture insights from any of 6 supported providers.


Why Laradar?

As a Laravel application grows, understanding its full structure becomes harder. New team members spend days reading code to understand what exists. Developers duplicate logic because they didn't know a service already existed. Architecture decisions get made without a clear picture of the whole.

Laradar gives everyone on the team - from the developer who wrote it to the one who just joined - an instant, accurate map of the application. No documentation to maintain. No diagrams to keep updated. Just install and the dashboard reflects the real state of the project at all times.


Quick Start

1. Install the package:

composer require vcian/laradar

2. Publish the config:

php artisan vendor:publish --tag=laradar-config

3. Visit the dashboard:

http://your-app.test/laradar

The dashboard is only accessible when APP_ENV=local or APP_ENV=development. It is automatically disabled in production.


Dashboard

Laradar Dashboard

Laradar scans your application once on page load and presents all data instantly.

Section What you see
Overview Architecture score, component counts, and an interactive architecture flowchart
Models Table mappings, fillable fields, hidden fields, casts, and relationships
Controllers Methods, route bindings, and class dependencies
Routes Full route list with HTTP method, URI, middleware, name, and controller
Migrations Every migration file with its table operation, column types, and foreign keys
Jobs Queue connections and class hierarchy
Events Listeners and broadcast channels
Services All classes discovered in App\Services
Repositories All classes discovered in App\Repositories
Observers Observed models and registered event hooks
Policies Guarded models and defined abilities
Middleware All registered middleware and their aliases
Modules Modular structure detection from Modules/ directory
Packages Installed Composer packages with version information
AI Insights AI-powered review of your architecture (requires AI configuration)

Artisan Reports

Generate a full architecture report without opening the browser:

php artisan laradar:scan

Export in a specific format:

php artisan laradar:scan --format=html
php artisan laradar:scan --format=json
php artisan laradar:scan --format=markdown

Reports are saved to storage/architecture/. The HTML report is also viewable in the browser at http://your-app.test/laradar/report.


Configuration

// config/laradar.php

return [
    'dashboard' => [
        'enabled'    => true,
        'path'       => 'laradar',       // dashboard URL: /laradar
        'middleware' => ['web'],
    ],

    'scan' => [
        'models'       => true,
        'controllers'  => true,
        'routes'       => true,
        'migrations'   => true,
        'jobs'         => true,
        'events'       => true,
        'services'     => true,
        'repositories' => true,
        'observers'    => true,
        'policies'     => true,
        'modules'      => true,
        'packages'     => true,
    ],

    'ai' => [
        'enabled'  => env('AI_ENABLED', false),
        'provider' => env('AI_PROVIDER'),

        // Async queue (optional — see Async AI section below)
        'async'       => env('LARADAR_AI_ASYNC', false),
        'queue'       => env('LARADAR_AI_QUEUE', 'default'),
        'job_timeout' => env('LARADAR_AI_JOB_TIMEOUT', 300),
    ],
];

AI Analysis

Laradar can send your architecture summary to an AI provider and return an architectural review directly inside the dashboard.

Enable it in your .env:

AI_ENABLED=true
AI_PROVIDER=gemini
GEMINI_API_KEY=your-key
GEMINI_MODEL=gemini-3.5-flash   # model used for all AI features

Supported providers:

Provider AI_PROVIDER API Key Model
Google Gemini gemini GEMINI_API_KEY GEMINI_MODEL
OpenAI openai OPENAI_API_KEY OPENAI_MODEL
Anthropic Claude anthropic ANTHROPIC_API_KEY ANTHROPIC_MODEL
Mistral mistral MISTRAL_API_KEY MISTRAL_MODEL
Ollama (local, no key needed) ollama — OLLAMA_MODEL
OpenRouter openrouter OPENROUTER_API_KEY OPENROUTER_MODEL

Async AI (Queue)

By default, AI requests (Analyze and Generate Docs) run synchronously — the browser waits for the AI provider to respond before the page updates. For large projects this can take 20–30 seconds and block the PHP worker during that time.

You can make AI requests non-blocking by running them as background queue jobs.

1. Set up the jobs table (one time):

php artisan queue:table
php artisan migrate

2. Enable async in .env:

LARADAR_AI_ASYNC=true
QUEUE_CONNECTION=database

3. Start the queue worker (second terminal):

php artisan queue:work

That's it. When you click Analyze or Generate Docs in the dashboard, the request returns immediately and the result appears automatically once the job completes — no page refresh needed.

Optional env keys:

Key Default Description
LARADAR_AI_ASYNC false Enable background job processing for AI requests
LARADAR_AI_QUEUE default Queue name to dispatch AI jobs on
LARADAR_AI_JOB_TIMEOUT 300 Max seconds the AI job is allowed to run
AI_MAX_TOKENS 8192 Max output tokens per AI response — increase for large projects (check your model's limit first)
AI_MAX_MESSAGE_LENGTH 5000 Max characters allowed per chat message

Note: If your application already uses queues for its own jobs, set LARADAR_AI_QUEUE=laradar and run a dedicated worker php artisan queue:work --queue=laradar so AI jobs don't compete with your application jobs.


Upgrading

When upgrading Laradar, if you have a published config/laradar.php, re-publish it to get new config keys:

php artisan vendor:publish --tag=laradar-config --force
php artisan optimize:clear

What Gets Scanned

Component Detected Information
Models Table, fillable, hidden, casts, relationships, observers
Controllers Methods, route bindings, dependencies
Routes URI, HTTP method, middleware, name, controller
Migrations Table operations, column types, foreign keys
Jobs Queue connection, class hierarchy
Events Listeners, broadcast channels
Services Classes in App\Services
Repositories Classes in App\Repositories
Observers Observed models, event hooks
Policies Guarded models, defined abilities
Middleware Registered middleware and aliases
Modules Detection from Modules/ directory
Packages Composer packages with version info

License

Laradar is open-sourced software licensed under the MIT license.

About

Detects everything in your codebase models, controllers, dependencies.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages