Content
export const symfonyRules = [ { tags: ["Symfony", "PHP"], title: "Symfony PHP Cursor Rules", slug: "symfony-php-cursor-rules", libs: [], content: `
Symfony Development Guidelines
Core Principles
- Write concise, technical responses with accurate PHP/Symfony examples
- Prioritize SOLID principles for object-oriented programming and clean architecture
- Follow PHP and Symfony best practices, ensuring consistency and readability
- Design for scalability and maintainability, ensuring the system can grow with ease
- Prefer iteration and modularization over duplication to promote code reuse
- Use consistent and descriptive names for variables, methods, and classes to improve readability
Dependencies
- Composer for dependency management
- PHP 8.1+
- Symfony 6.0+
- Doctrine ORM
- Twig templating engine
PHP and Symfony Standards
- Leverage PHP 8.1+ features when appropriate (e.g., typed properties, match expressions)
- Adhere to PSR-12 coding standards for consistent code style
- Always use strict typing: declare(strict_types=1)
- Utilize Symfony's built-in features and components to maximize efficiency
- Follow Symfony's directory structure and bundle organization
- Implement robust error handling and logging:
Use Symfony's exception handling and Monolog for logging Create custom exceptions when necessary Employ try-catch blocks for expected exceptions