{"id":39757095,"url":"https://github.com/spiechu/symfony-commons-bundle","last_synced_at":"2026-01-18T11:31:56.456Z","repository":{"id":57056717,"uuid":"99513444","full_name":"spiechu/symfony-commons-bundle","owner":"spiechu","description":"Symfony Commons Bundle","archived":false,"fork":false,"pushed_at":"2019-10-28T20:33:24.000Z","size":275,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-31T08:43:22.715Z","etag":null,"topics":["api-versioning","schema-validation","symfony","symfony-bundle"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spiechu.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-06T21:09:08.000Z","updated_at":"2019-10-28T20:33:26.000Z","dependencies_parsed_at":"2022-08-24T14:00:36.463Z","dependency_job_id":null,"html_url":"https://github.com/spiechu/symfony-commons-bundle","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/spiechu/symfony-commons-bundle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spiechu%2Fsymfony-commons-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spiechu%2Fsymfony-commons-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spiechu%2Fsymfony-commons-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spiechu%2Fsymfony-commons-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spiechu","download_url":"https://codeload.github.com/spiechu/symfony-commons-bundle/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spiechu%2Fsymfony-commons-bundle/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28535169,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T10:13:46.436Z","status":"ssl_error","status_checked_at":"2026-01-18T10:13:11.045Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-versioning","schema-validation","symfony","symfony-bundle"],"created_at":"2026-01-18T11:31:55.589Z","updated_at":"2026-01-18T11:31:56.421Z","avatar_url":"https://github.com/spiechu.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Symfony Commons Bundle\n\n| TravisCI | StyleCI | Scrutinizer | Code Coverage |\n|:--------:|:-------:|:-----------:|:-------------:|\n| [![Build Status](https://travis-ci.org/spiechu/symfony-commons-bundle.svg?branch=master)](https://travis-ci.org/spiechu/symfony-commons-bundle) | [![StyleCI](https://styleci.io/repos/99513444/shield?style=flat)](https://styleci.io/repos/99513444) | [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/spiechu/symfony-commons-bundle/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/spiechu/symfony-commons-bundle/?branch=master) | [![Code Coverage](https://scrutinizer-ci.com/g/spiechu/symfony-commons-bundle/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/spiechu/symfony-commons-bundle/?branch=master) |\n\n## Intro\n\nMain purpose of this bundle is to introduce some \"missing\" functionalities to Symfony Framework.\n\nConsider this bundle as part of my preparations for Symfony Certification.\nI can only learn by doing instead of passive DOC reading.\n\nBundle characteristics:\n- plays well with [FOSRestBundle](https://github.com/FriendsOfSymfony/FOSRestBundle)\n- [Symfony Flex ready](https://github.com/symfony/recipes-contrib/tree/master/spiechu/symfony-commons-bundle)\n\n## Bundle rules\n\n1. Every feature is disabled by default. You only enable what you need.\n2. No event listeners hanging around when unneeded.\n3. Provide sane defaults and extensive customisation possibilities.\n\n## Features\n\n### GET method override\n\nEnabling this feature will allow you to use URLs like `http://myapp.com/mypath?_method=DELETE` or `PUT` to override HTTP GET request method.\n\nSometimes you might need such functionality for example in admin area to ban / delete users.\nYou can expose simple links and still have clean PUT / DELETE controller actions.\n\nFull [documentation here](src/Resources/doc/get_method_override.md).\n\n### Response schema validation\n\nResponse schema validation allows you to validate endpoint responses on-the-fly.\nYou just need to annotate controller action with `@ResponseSchemaValidator` annotation.\n\nTypical use case is:\n\n```php\n// src/AppBundle/Controller/AdminController.php\n\nuse Spiechu\\SymfonyCommonsBundle\\Annotation\\Controller\\ResponseSchemaValidator;\n\nclass AdminController extends Controller\n{\n    /**\n     * @Route(\"/\", name=\"my_route\")\n     *\n     * @ResponseSchemaValidator(\n     *  json={\n     *   200=\"@AppBundle/Resources/response_schema/my_route_200.json\",\n     *   500=\"@AppBundle/Resources/response_schema/my_route_500.json\"\n     *  }\n     * )\n     */\n    public function indexAction(): Response\n    {\n        // ...\n    }\n}\n```\n\nFull [documentation here](src/Resources/doc/response_schema_validation.md).\n\n### API versioning\n\nWhen you have multiple API versions it's usually done by extending Controllers.\nThis bundle introduces handy `@ApiVersion` annotation.\nYou need to annotate your controller classes with this custom annotation and set version like:\n\n```php\n// src/AppBundle/Controller/V1_0/UserController.php\n\nuse Spiechu\\SymfonyCommonsBundle\\Annotation\\Controller\\ApiVersion;\n\n/**\n * @ApiVersion(\"1.0\")\n */\nclass UserController extends Controller\n{\n    /**\n     * @Route(\"/\", name=\"my_route\")\n     */\n    public function indexAction(): Response\n    {\n        // ...\n    }\n}\n```\n\nThen in extending class:\n\n```php\n// src/AppBundle/Controller/V1_1/UserController.php\n\nuse Spiechu\\SymfonyCommonsBundle\\Annotation\\Controller\\ApiVersion;\nuse Spiechu\\SymfonyCommonsBundle\\Controller\\V1_0\\UserController as BaseUserController;\n\n/**\n * @ApiVersion(\"1.1\")\n */\nclass UserController extends BaseUserController\n{\n    /**\n     * @Route(\"/\", name=\"my_route\")\n     */\n    public function indexAction(): Response\n    {\n        // ...\n    }\n}\n```\n\nFrom now on you can inject `Spiechu\\SymfonyCommonsBundle\\Service\\ApiVersionProvider` service to your services and check what is the current request API version.\n\nFull [documentation here](src/Resources/doc/api_versioning.md).\n\n## Installation\n\nI'm assuming you have Composer installed globally.\n\n### Flex based installation (Symfony 3.4 and 4)\n\n#### Download \u0026 enable the Bundle\n\nRun console command in Symfony project directory:\n\n```bash\ncomposer req spiechu/symfony-commons-bundle\n```\n\n#### Enable some/all Bundle features\n\n```yaml\n# config/packages/spiechu_symfony_commons.yml\n\nspiechu_symfony_commons:\n    get_method_override:\n        enabled: true\n    response_schema_validation:\n        enabled: true\n    api_versioning:\n        enabled: true\n```\n\n### Composer based installation (Symfony 3.4)\n\n#### Download the Bundle\n\nRun console command in Symfony project directory:\n\n```bash\ncomposer require spiechu/symfony-commons-bundle\n```\n\n#### Enable the Bundle\n\nEnable the bundle by adding the following line in the `app/AppKernel.php` file of your project:\n\n```php\n// app/AppKernel.php\n\nclass AppKernel extends Kernel\n{\n    public function registerBundles()\n    {\n        $bundles = [\n            // ...\n            new Spiechu\\SymfonyCommonsBundle\\SpiechuSymfonyCommonsBundle(),\n        ];\n\n        // ...\n    }\n}\n```\n\n#### Enable some/all Bundle features\n\nPreferred way of configuring Bundle is via YAML config:\n\n```yaml\n# app/config/config.yml\n\nspiechu_symfony_commons:\n    get_method_override:\n        enabled: true\n    response_schema_validation:\n        enabled: true\n    api_versioning:\n        enabled: true\n```\n\n## Configuration\n\nConfiguration reference [can be found here](src/Resources/doc/configuration_reference.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspiechu%2Fsymfony-commons-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspiechu%2Fsymfony-commons-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspiechu%2Fsymfony-commons-bundle/lists"}