niduranga / laravel-dev-guard
AI-powered TDD test generator for Laravel Actions
Requires
- php: ^8.2|^8.3|^8.4|^8.5
- illuminate/support: ^10.0|^11.0|^12.0|^13.0
Requires (Dev)
- orchestra/testbench: ^11.1
- pestphp/pest: ^4.6
- pestphp/pest-plugin-laravel: ^4.1
README
Laravel DevGuard is an AI-powered TDD companion designed specifically for the Laravel Action pattern. It automates the tedious task of writing unit and feature tests by analyzing your business logic and generating production-ready Pest or PHPUnit tests using Google's Gemini AI.
Stop being a "Balu" developer spending hours on boilerplate tests. Focus on the logic, and let DevGuard handle the coverage.
🚀 Features
- Auto-Framework Detection: Automatically detects whether your project uses Pest or PHPUnit.
- Context-Aware Generation: Analyzes your Action classes and intelligently mocks dependencies.
- One-Command Setup: Seamless installation and configuration.
- Gemini AI Powered: Uses high-speed, high-accuracy LLMs to understand your code flow.
- SOLID Compliant: Generates tests that follow clean architecture and best practices.
📦 Installation
You can install the package via composer:
composer require niduranga/laravel-dev-guard
After the package is installed, run the installation command to publish the configuration file:
php artisan devguard:install
⚙️ Configuration
- Get your free API Key from the Google AI Studio.
- Add the following key to your
.envfile:
GEMINI_API_KEY=your_actual_api_key_here # Optional: Defaults to gemini-2.5-flash for high performance you can change to other models GEMINI_MODEL=gemini-3-flash-preview
🛠️ Usage
Simply point DevGuard to any Action class in your project.
php artisan guard:test Actions/CreateUserAction
What happens next?
- Scanning: DevGuard reads your
CreateUserActionclass. - Analysis: It identifies DB interactions, events, and external API calls.
- Generation: AI generates a comprehensive test suite.
- Saving: The test file is automatically saved in
tests/Feature/ortests/Unit/.
✅ Testing
We take testing seriously. This package is fully tested with Pest.
composer test
🤝 Contributing
Contributions are welcome! If you have ideas for new features or improvements, feel free to open an issue or submit a pull request.
📄 License
The MIT License (MIT). Please see License File for more information.
Developed with ❤️ by Niduranga Jayarathna