{"kind":"AgentDefinition","metadata":{"namespace":"community","name":"php-symfony","version":"0.1.0"},"spec":{"agents_md":"---\ndescription: \"Symfony development standards aligned with official Symfony Best Practices\"\napplyTo: \"**/*.php, **/*.yaml, **/*.yml, **/*.xml, **/*.twig\"\n---\n\n# Symfony Development Instructions\n\nInstructions for developing Symfony applications following the official Symfony Best Practices and core framework philosophy.\n\n## Project Context\n- Symfony (latest stable or LTS)\n- Default Symfony directory structure\n- Autowiring and autoconfiguration enabled\n- Doctrine ORM when persistence is needed\n- Twig for templating\n- Symfony Forms, Validator, Security, Messenger as needed\n- PHPUnit for testing\n- Attribute-based configuration where supported\n\n## Project Structure\n- Use the default Symfony directory structure\n- Do not create bundles for application code\n- Organize application code using PHP namespaces\n- Keep configuration in `config/`, application code in `src/`, templates in `templates/`\n\n## Configuration\n\n### Environment Configuration\n- Use environment variables for infrastructure-related configuration\n- Use `.env` files to define environment-specific values\n- Do not use environment variables to control application behavior\n\n### Sensitive Configuration\n- Store secrets (API keys, credentials) using Symfony Secrets\n- Never commit secrets to the repository\n\n### Application Configuration\n- Use parameters in `config/services.yaml` for application behavior configuration\n- Override parameters per environment only when needed\n- Prefix parameters with `app.` to avoid collisions\n- Use short, descriptive parameter names\n- Use PHP constants for configuration values that rarely change\n\n## Services \u0026 Dependency Injection\n- Use dependency injection exclusively\n- Prefer constructor injection\n- Use autowiring and autoconfiguration by default\n- Keep services private whenever possible\n- Avoid accessing services via `$container-\u003eget()`\n- Use YAML as the preferred format for service configuration\n- Use interfaces where it improves decoupling or clarity\n\n## Controllers\n- Extend `AbstractController`\n- Keep controllers thin and focused on glue code\n- Do not place business logic in controllers\n- Use attributes to configure routing, caching, and security\n- Use dependency injection for services\n- Use Entity Value Resolvers when convenient and appropriate\n- Perform complex queries explicitly via repositories when needed\n\n## Doctrine \u0026 Persistence\n- Use Doctrine entities as plain PHP objects\n- Define Doctrine mapping using PHP attributes\n- Use repositories for querying data\n- Avoid putting business logic in repositories\n- Use migrations for all schema changes\n\n## Templates (Twig)\n- Use snake_case for template names, directories, and variables\n- Prefix template fragments with an underscore\n- Keep templates focused on presentation\n- Avoid business logic in Twig templates\n- Escape output by default\n- Avoid using `|raw` unless content is trusted and sanitized\n\n## Forms\n- Define forms as PHP classes\n- Do not build forms directly in controllers\n- Add form buttons in templates, not in form classes\n- Define validation constraints on the underlying object\n- Use a single controller action to render and process each form\n- Define submit buttons in controllers only when multiple submits are required\n\n## Validation\n- Use Symfony Validator constraints\n- Validate data at application boundaries\n- Prefer object-level validation over form-only validation when reuse is needed\n\n## Internationalization\n- Use XLIFF for translation files\n- Use translation keys instead of literal content strings\n- Use descriptive keys that express purpose, not location\n\n## Security\n- Prefer a single firewall unless multiple systems are required\n- Use the auto password hasher\n- Use voters for complex authorization logic\n- Avoid complex security expressions in attributes\n\n## Web Assets\n- Use AssetMapper to manage web assets\n- Avoid unnecessary frontend build complexity unless required\n\n## Asynchronous Processing\n- Use Symfony Messenger for async and background tasks\n- Keep message handlers small and focused\n- Configure failure transports for failed messages\n\n## Testing\n- Write functional tests using `WebTestCase`\n- Add smoke tests to ensure all public URLs respond successfully\n- Hard-code URLs in functional tests instead of generating routes\n- Use unit tests where appropriate for isolated logic\n- Add more specific tests incrementally as the application evolves\n\n## General Guidelines\n- Prefer clarity over abstraction\n- Follow Symfony conventions before introducing custom patterns\n- Keep configuration explicit and readable\n- Avoid premature optimization\n- Use Symfony Demo as a reference implementation\n","description":"Symfony development standards aligned with official Symfony Best Practices","import":{"commit_sha":"541b7819d8c3545c6df122491af4fa1eae415779","imported_at":"2026-05-18T20:05:35Z","license_text":"MIT License\n\nCopyright GitHub, Inc.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.","owner":"github","repo":"github/awesome-copilot","source_url":"https://github.com/github/awesome-copilot/blob/541b7819d8c3545c6df122491af4fa1eae415779/instructions/php-symfony.instructions.md"},"manifest":{}},"content_hash":[37,79,163,230,255,19,179,204,84,57,38,38,185,168,188,253,188,26,178,34,128,8,24,150,175,137,1,172,171,192,54,35],"trust_level":"unsigned","yanked":false}
