araminco/laravel-ai-mapper
最新稳定版本:v1.2.3
Composer 安装命令:
composer require araminco/laravel-ai-mapper
包简介
A Laravel package to generate an AI-friendly map of the project structure, database, and dependencies.
README 文档
README
A Laravel Artisan command that scans your project and generates a comprehensive, AI-friendly JSON map. This map allows AI models to understand your project's architecture, overcoming context limits and enabling more intelligent, context-aware assistance.
✨ Features
This package extracts and maps the following information into a single JSON file:
- Project Overview: App name, Laravel, and PHP versions.
- Environment Details: Key configuration values like environment, debug mode, and drivers for cache, queue, and session.
- Database Schema: A list of all tables along with their columns, indexes, and foreign keys, with a resilient connection mechanism.
- Model Structure: Extracts all Eloquent models, including properties (
$fillable,$casts, etc.) and their defined Eloquent relationships. - Route List: All web and API routes, including methods, URIs, and middleware.
- Scheduled Commands: A list of all cron jobs defined in your Console Kernel.
- Event Listeners: A map of all registered events and their corresponding listeners.
- Composer Dependencies: A list of packages used in the project.
- FilamentPHP Structure (if detected): Automatically discovers panels, resources, pages, and widgets.
💿 Installation
You can install the package via Composer:
composer require araminco/laravel-ai-mapper
🚀 Usage
To generate the project map, run the following Artisan command:
php artisan ai:map
This will create a file named ai-project-map.json in your project's root directory.
Controlling the Output Size
You can control the size and content of the map using the following options.
Compact Mode
Use the --compact flag to generate a summarized version that is significantly smaller. This mode simplifies verbose sections like the database schema and routes.
php artisan ai:map --compact
Excluding Sections
You can also completely exclude sections from the map:
--no-db: Excludes the database schema.--no-files: Excludes the directory structure.--no-models: Excludes the model analysis.--no-routes: Excludes the route list.--no-deps: Excludes composer dependencies.--no-filament: Excludes the Filament structure.--no-env: Excludes environment details.--no-schedule: Excludes scheduled commands.--no-events: Excludes event listeners.
📄 Output Sample
The generated JSON file will have a structure similar to this:
{
"projectName": "My Laravel App",
"laravelVersion": "12.0.0",
"environment": {
"environment": "local",
"debug_mode": true,
"cache_driver": "file",
"queue_connection": "sync",
"session_driver": "file"
},
"databaseSchema": { "...": "..." },
"models": [
{
"class": "App\\Models\\User",
"table": "users",
"relationships": { "...": "..." }
}
],
"routes": [ "...": "..." ],
"scheduledCommands": [
"$schedule->command('inspire')->hourly();"
],
"eventListeners": {
"Illuminate\\Auth\\Events\\Registered": [
"Illuminate\\Auth\\Listeners\\SendEmailVerificationNotification"
]
},
"filament": { "...": "..." }
}
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
📜 License
This package is open-sourced software licensed under the MIT license.
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-20