PHP code example of mohamed-elgeady / artisan-architect
1. Go to this page and download the library: Download mohamed-elgeady/artisan-architect library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mohamed-elgeady / artisan-architect example snippets
'paths' => [
'controllers' => [
base_path('app/Http/Controllers'),
base_path('Modules/*/Http/Controllers'), // ✅ Scans ALL modules automatically
],
'models' => [
base_path('app/Models'),
base_path('Modules/*/Models'),
],
'requests' => [
base_path('app/Http/Requests'),
base_path('Modules/*/Http/Requests'),
],
'resources' => [
base_path('app/Http/Resources'),
base_path('Modules/*/Http/Resources'),
],
'routes' => [
base_path('routes'),
base_path('Modules/*/routes'),
],
],
// config/artisan-architect.php
return [
// ─────────────────────────────────────────
// Paths to scan. Supports strings AND arrays
// with glob wildcards (*) for Module support.
// ─────────────────────────────────────────
'paths' => [
'controllers' => [
base_path('app/Http/Controllers'),
// base_path('Modules/*/Http/Controllers'),
],
'models' => [
base_path('app/Models'),
],
// ... routes, requests, resources, services
],
// ─────────────────────────────────────────
// Rule thresholds — tune to your standards.
// ─────────────────────────────────────────
'rules' => [
'controllers' => [
'max_methods' => 10,
'max_lines' => 200,
'allow_db_queries' => false, // penalize direct DB facade usage
'bash
php artisan vendor:publish --tag=artisan-architect-config
bash
php artisan architect:graph
# → Graph exported successfully to: storage/artisan-architect/graphs/architecture.html