A comprehensive GitHub Copilot configuration for PHP development, providing expert-level guidance for modern PHP applications with security, performance, accessibility, and best practices built-in.
This repository contains specialized GitHub Copilot configurations that transform your coding assistant into a Senior PHP Architect and Security Specialist. It includes:
- Expert Chatmodes: Specialized personas for PHP, Laravel, Symfony, and API development, each with summaries, usage examples, success criteria, accessibility, security, and standards references
- Prompt Library: Ready-to-use prompts for common PHP development tasks, all updated for imperative language, explicit criteria, accessibility, security, and standards compliance
- Instructions & Standards: Comprehensive PHP, Laravel, Symfony, and API coding standards, with summaries, usage, criteria, accessibility, security, and standards/version compatibility
- Framework Support: Guidance for Laravel, Symfony, and modern PHP patterns
- GitHub Copilot subscription (required for all functionality)
- VS Code with GitHub Copilot extension installed
- Git (for cloning the repository)
- PHP 8.2+ (recommended for validation scripts and generated code)
code --list-extensions | grep -i copilot
php --version
git --version- Clone this repository to your local machine
- Open the folder in VS Code with GitHub Copilot enabled
- The chatmodes, prompts, and instructions will be automatically available
git clone https://github.com/leifrogers/php-copilot.git
cd php-copilot
code .php scripts/validate.php $(pwd)If the validation passes, you should see confirmation that all components are properly configured.
Copy the desired chatmode file to your VS Code chatmodes directory:
cp chatmodes/PHP-Expert.chatmode.md ~/.vscode/chatmodes/In GitHub Copilot Chat, activate the relevant expert mode and use these commands:
/plan- Break down feature requests into detailed implementation plans/review- Perform comprehensive security, accessibility, and performance code reviews/generate- Create PHP code following best practices/test- Generate PHPUnit tests for your classes
Use the specialized prompts in the prompts/ directory for specific tasks:
create-phpunit-test.prompt.md- Generate comprehensive test suitescreate-laravel-crud.prompt.md- Create complete Laravel CRUD resourcesrefactor-to-class.prompt.md- Modernize legacy procedural codecreate-symfony-service-class.prompt.md- Generate Symfony service classes- ...and more, all updated for standards, accessibility, and security
@PHP-Expert /plan
Create a user authentication system with JWT tokens, rate limiting, and password reset functionality.
@PHP-Expert /review
[Select your PHP code and the expert will provide security, accessibility, performance, and architectural feedback]
Use the create-phpunit-test prompt with #file pointing to your PHP class to generate comprehensive PHPUnit tests.
- SQL injection prevention with prepared statements
- XSS protection, input validation, and CSRF token implementation
- Secure file handling and authentication patterns
- Accessibility reminders and WCAG 2.2 compliance in all prompts and standards
- Modern PHP 8.x features (enums, readonly properties, union types)
- Efficient database query patterns
- Caching strategies and memory optimization
- N+1 query prevention
- PSR-1, PSR-4, PSR-12 compliance
- SOLID principles enforcement
- Comprehensive PHPDoc documentation
- Test-driven development practices
- Explicit standards and version compatibility in all instructions and chatmodes
- Laravel best practices (Eloquent, Form Requests, Middleware)
- Symfony patterns (DI Container, Services, Doctrine)
- Modern PHP patterns and architecture
php-copilot/
βββ chatmodes/
β βββ API-Expert.chatmode.md # API development specialist
β βββ Laravel-Expert.chatmode.md # Laravel framework expert
β βββ PHP-Expert.chatmode.md # Main PHP expert persona
β βββ Symfony-Expert.chatmode.md # Symfony framework expert
βββ instructions/
β βββ api-standards.instructions.md # API development standards
β βββ laravel-standards.instructions.md # Laravel coding standards
β βββ php-standards.instructions.md # Comprehensive PHP standards
β βββ symfony-standards.instructions.md # Symfony coding standards
βββ prompts/
β βββ review-code.prompt.md # Code review and analysis
β βββ create-api-endpoint.prompt.md # API endpoint generation
β βββ create-migration.prompt.md # Database migration creation
β βββ create-phpunit-test.prompt.md # Test generation
β βββ create-laravel-crud.prompt.md # Laravel CRUD scaffolding
β βββ analyze-performance.prompt.md # Performance optimization
β βββ refactor-legacy-code.prompt.md # Legacy code modernization
β βββ refactor-to-class.prompt.md # OOP refactoring
β βββ review-security.prompt.md # Security analysis
β βββ create-symfony-service-class.prompt.md # Symfony service creation
βββ scripts/
β βββ validate.php # Validation script
βββ LICENSE # MIT License
βββ README.md # This file
- GitHub Copilot subscription
- VS Code with GitHub Copilot extension
- PHP 8.2+ development environment (for generated code)
The PHP Expert is designed to be your senior colleague in the codebase. It will:
- Explain architectural decisions and best practices
- Provide security-focused and accessible solutions
- Generate production-ready code with proper error handling
- Create comprehensive tests for your classes
- Help modernize legacy PHP applications
- Ensure you have an active GitHub Copilot subscription
- Verify the extension is enabled in VS Code
- Try reloading VS Code window (
Cmd+Ron macOS)
- Check that chatmode files are in the correct directory
- Restart VS Code after copying files
- Verify file permissions are correct
php --version
ls -la scripts/validate.php
php scripts/validate.php $(pwd) --verbose- Create an issue on GitHub for bugs or feature requests
- Check existing issues for similar problems
- Provide system information and error messages when reporting issues
A: Yes, this project requires an active GitHub Copilot subscription to function.
A: Absolutely! All files are designed to be customizable for your team's needs.
A: PHP 8.2 and higher. The generated code uses modern PHP features.
A: Currently optimized for VS Code, but prompts and instructions can be adapted for other editors.
We welcome contributions that enhance the PHP development experience! Here's how to contribute:
- Fork the repository and create a feature branch
- Follow standards outlined in the instructions files
- Test your changes using the validation script
- Update documentation if adding new features
- Submit a pull request with a clear description
- Additional framework-specific chatmodes
- New prompts for common development tasks
- Security and accessibility enhancements
- Performance optimization patterns
- Documentation improvements
- Follow PSR-12 coding standards
- Include comprehensive documentation
- Add tests for new functionality
- Maintain backward compatibility