Skip to content

A comprehensive GitHub Copilot configuration that transforms your coding assistant into a Senior PHP Architect and Security Specialist

License

Notifications You must be signed in to change notification settings

leifrogers/php-copilot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PHP Copilot Expert

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.

What This Project Provides

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

Prerequisites

  • 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)

Verify Prerequisites

code --list-extensions | grep -i copilot
php --version
git --version

Installation

  1. Clone this repository to your local machine
  2. Open the folder in VS Code with GitHub Copilot enabled
  3. The chatmodes, prompts, and instructions will be automatically available
git clone https://github.com/leifrogers/php-copilot.git
cd php-copilot
code .

Verify Installation

php scripts/validate.php $(pwd)

If the validation passes, you should see confirmation that all components are properly configured.

Quick Start

1. Install the Chatmode

Copy the desired chatmode file to your VS Code chatmodes directory:

cp chatmodes/PHP-Expert.chatmode.md ~/.vscode/chatmodes/

2. Use Expert Commands

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

3. Access Prompt Library

Use the specialized prompts in the prompts/ directory for specific tasks:

  • create-phpunit-test.prompt.md - Generate comprehensive test suites
  • create-laravel-crud.prompt.md - Create complete Laravel CRUD resources
  • refactor-to-class.prompt.md - Modernize legacy procedural code
  • create-symfony-service-class.prompt.md - Generate Symfony service classes
  • ...and more, all updated for standards, accessibility, and security

Example Usage

Planning a Feature

@PHP-Expert /plan
Create a user authentication system with JWT tokens, rate limiting, and password reset functionality.

Code Review

@PHP-Expert /review
[Select your PHP code and the expert will provide security, accessibility, performance, and architectural feedback]

Generate Tests

Use the create-phpunit-test prompt with #file pointing to your PHP class to generate comprehensive PHPUnit tests.

Features

πŸ”’ Security-First & Accessible

  • 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

⚑ Performance Optimized

  • Modern PHP 8.x features (enums, readonly properties, union types)
  • Efficient database query patterns
  • Caching strategies and memory optimization
  • N+1 query prevention

πŸ“ Standards Compliant

  • 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

πŸ—οΈ Framework Expertise

  • Laravel best practices (Eloquent, Form Requests, Middleware)
  • Symfony patterns (DI Container, Services, Doctrine)
  • Modern PHP patterns and architecture

Project Structure

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

Requirements

  • GitHub Copilot subscription
  • VS Code with GitHub Copilot extension
  • PHP 8.2+ development environment (for generated code)

Getting Help

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

Troubleshooting

Common Issues

GitHub Copilot Not Working

  • Ensure you have an active GitHub Copilot subscription
  • Verify the extension is enabled in VS Code
  • Try reloading VS Code window (Cmd+R on macOS)

Chatmode Not Available

  • Check that chatmode files are in the correct directory
  • Restart VS Code after copying files
  • Verify file permissions are correct

Validation Script Fails

php --version
ls -la scripts/validate.php
php scripts/validate.php $(pwd) --verbose

Getting Support

  • 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

FAQ

Q: Do I need a GitHub Copilot subscription?

A: Yes, this project requires an active GitHub Copilot subscription to function.

Q: Can I customize the chatmodes and prompts?

A: Absolutely! All files are designed to be customizable for your team's needs.

Q: What PHP versions are supported?

A: PHP 8.2 and higher. The generated code uses modern PHP features.

Q: Does this work with other editors besides VS Code?

A: Currently optimized for VS Code, but prompts and instructions can be adapted for other editors.

Contributing

We welcome contributions that enhance the PHP development experience! Here's how to contribute:

Contributing Guidelines

  1. Fork the repository and create a feature branch
  2. Follow standards outlined in the instructions files
  3. Test your changes using the validation script
  4. Update documentation if adding new features
  5. Submit a pull request with a clear description

Areas for Contribution

  • Additional framework-specific chatmodes
  • New prompts for common development tasks
  • Security and accessibility enhancements
  • Performance optimization patterns
  • Documentation improvements

Code Standards

  • Follow PSR-12 coding standards
  • Include comprehensive documentation
  • Add tests for new functionality
  • Maintain backward compatibility

About

A comprehensive GitHub Copilot configuration that transforms your coding assistant into a Senior PHP Architect and Security Specialist

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages