shaungbhone / laravel-ai-doctor
Detect AI provider compatibility issues in Laravel before runtime.
Requires
- php: ^8.3
- illuminate/console: ^12.0|^13.0
- illuminate/filesystem: ^12.0|^13.0
- illuminate/support: ^12.0|^13.0
- laravel/ai: ^1.0
- nikic/php-parser: ^5.6
Requires (Dev)
- laravel/pint: ^1.26
- orchestra/testbench: ^10.0|^11.0
- phpunit/phpunit: ^11.5|^12.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Detect AI provider compatibility problems in Laravel before runtime.
Goal
Laravel AI Doctor scans your Laravel source code and reports features that may behave differently across AI providers.
php artisan ai:doctor
Example output:
Laravel AI Doctor — provider: gemini
✓ SupportAgent
! InvoiceAgent
✕ $ref may be incompatible with gemini
Installation
composer config repositories.ai-doctor vcs https://github.com/ShaungBhone/laravel-ai-doctor composer require shaungbhone/laravel-ai-doctor:^0.1 --dev
These commands install the tagged release directly from GitHub while Packagist registration is pending. Laravel package auto-discovery registers the command automatically.
Usage
Check the configured Laravel AI provider:
php artisan ai:doctor
List the installed SDK provider capabilities with php artisan ai:doctor --providers.
Check a specific provider:
php artisan ai:doctor --provider=gemini
Status
This package requires Laravel AI SDK v1 and performs static compatibility analysis without executing prompts or making API calls. It resolves direct Agent interface imports and native tool aliases, collects schema method calls, and checks native tool support against the installed SDK's provider interfaces.
Text drivers include OpenAI, Anthropic, Gemini, Azure, Bedrock, DeepSeek, Groq, Mistral, Ollama, OpenRouter, xAI, and OpenAI Compatible. Configured provider aliases use their configured driver. Unknown drivers and non-text providers fail. Unsupported native tools are errors; Anthropic schema constraints are warnings because the SDK may simplify them.
The scanner does not verify inherited agent implementations, helper-created tools, dynamic schema keys, models, credentials, or remote endpoints. A clean result means no issues were found by the current static checks. The former blanket Gemini schema-reference rejection has been removed; current Gemini documentation includes reference support.
See Laravel AI SDK, Anthropic structured outputs, and Gemini structured outputs for current behavior.
Roadmap
- Discover Laravel AI agents reliably
- Detect structured-output schema features
- Detect provider-specific tool support
- Provider/model compatibility matrix
- CI-friendly exit codes
- PHPStan integration
License
MIT
Package tests
Run independently from the demo application:
composer install
composer test
composer lint
Orchestra Testbench boots a minimal Laravel application with the AI SDK and AI Doctor providers. Tests live in tests/ and define their sample source inline. Temporary scan files are created and deleted by the tests; no fixture directory or demo-app files are needed, and no database migrations or API credentials are required. CI runs both PHPUnit and Pint on PHP 8.3 and 8.4.