{"id":2932392,"url":"https://github.com/sroze/api-platform-messenger","last_synced_at":"2025-04-13T22:32:28.281Z","repository":{"id":57058615,"uuid":"143315922","full_name":"sroze/api-platform-messenger","owner":"sroze","description":"Uses API Platform to exposes Commands \u0026 Queries dispatched to your Symfony Messenger bus","archived":false,"fork":false,"pushed_at":"2018-08-30T09:55:43.000Z","size":11,"stargazers_count":31,"open_issues_count":1,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-06T22:34:13.592Z","etag":null,"topics":["api-platform","symfony","symfony-bundle","symfony-messenger"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sroze.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-02T15:52:07.000Z","updated_at":"2023-06-22T20:19:19.000Z","dependencies_parsed_at":"2022-08-24T07:30:39.413Z","dependency_job_id":null,"html_url":"https://github.com/sroze/api-platform-messenger","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sroze%2Fapi-platform-messenger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sroze%2Fapi-platform-messenger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sroze%2Fapi-platform-messenger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sroze%2Fapi-platform-messenger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sroze","download_url":"https://codeload.github.com/sroze/api-platform-messenger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248790731,"owners_count":21162081,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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-platform","symfony","symfony-bundle","symfony-messenger"],"created_at":"2024-01-30T15:37:03.347Z","updated_at":"2025-04-13T22:32:27.956Z","avatar_url":"https://github.com/sroze.png","language":"PHP","funding_links":[],"categories":["Table of Contents"],"sub_categories":["awesome-api-platform-bundles"],"readme":"# Symfony Messenger \u0026 API Platform integration\n\nUsing a message bus like [Symfony Messenger](https://symfony.com/doc/current/messenger.html) is a wonderful way of structuring\nyour application around commands or queries (which will _just_ be PHP classes). [API Platform](https://api-platform.com/) is\na great framework to expose APIs.\n\nThe point of this bridge is to enable you to build business actions-centric APIs instead of CRUD APIs. [Check this very simple example](https://github.com/sroze/api-platform-messenger-example).\n\n**Note:** This is still an experimentation. You will likely have to contribute to make it fit your needs. Looking forward to review your pull-requests!\n\n## Usage\n\n1. Get an API Platform application. Easiest is to use Symfony's `api` pack:\n   ```bash\n   composer create-project symfony/skeleton api-platform-and-messenger \u0026\u0026 \\\n   cd api-platform-and-messenger \u0026\u0026 \\\n   composer req api\n   ```\n\n2. Install this bridge\n   ```bash\n   composer req sroze/api-platform-messenger:dev-master\n   ```\n\n3. Configure your message(s) to be handled by API Platform like in the following example:\n   ```php\n   \u003c?php\n   \n   namespace App\\Message;\n   \n   use Sam\\ApiPlatform\\Messenger\\Annotation\\ApiMessage;\n   use Symfony\\Component\\Validator\\Constraints\\NotBlank;\n   \n   /**\n    * @ApiMessage(\n    *   path=\"/write-message\",\n    *   type=\"command\"\n    * )\n    */\n   class WriteMessage\n   {\n       /**\n        * @NotBlank\n        *\n        * @var string\n        */\n       public $message;\n   }\n   ```\n\n## Reference\n\n### `@ApiMessage` annotation\n\n- `path`. The URL path where your command will be exposed.\n- `type`. The type of message. Can be:\n   - `query`: Will be exposed via a `GET` method\n   - `command`: Will be exposed via a `POST` method\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsroze%2Fapi-platform-messenger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsroze%2Fapi-platform-messenger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsroze%2Fapi-platform-messenger/lists"}