All Projects → sroze → api-platform-messenger

sroze / api-platform-messenger

Licence: other
Uses API Platform to exposes Commands & Queries dispatched to your Symfony Messenger bus

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to api-platform-messenger

Core
The server component of API Platform: hypermedia and GraphQL APIs in minutes
Stars: ✭ 2,004 (+6364.52%)
Mutual labels:  symfony-bundle, api-platform
Api Platform
Create REST and GraphQL APIs, scaffold Jamstack webapps, stream changes in real-time.
Stars: ✭ 7,144 (+22945.16%)
Mutual labels:  symfony-bundle, api-platform
Rich Model Forms Bundle
Provides additional data mappers that ease the use of the Symfony Form component with rich models.
Stars: ✭ 198 (+538.71%)
Mutual labels:  symfony-bundle
Lexikmaintenancebundle
This Symfony2 bundle allows you to place your website in maintenance mode by calling two commands in your console. A page with status code 503 appears to users, it is possible to authorize certain ips addresses stored in your configuration.
Stars: ✭ 253 (+716.13%)
Mutual labels:  symfony-bundle
Alicedatafixtures
Nelmio Alice extension to persist the loaded fixtures.
Stars: ✭ 228 (+635.48%)
Mutual labels:  symfony-bundle
Liiphellobundle
[DEPRECATED] Alternative Hello World Bundle for Symfony2 using several FriendsOfSymfony Bundles
Stars: ✭ 206 (+564.52%)
Mutual labels:  symfony-bundle
Easyadminextensionbundle
Provides some additional features to EasyAdminBundle for Symfony
Stars: ✭ 232 (+648.39%)
Mutual labels:  symfony-bundle
Alice
Expressive fixtures generator
Stars: ✭ 2,289 (+7283.87%)
Mutual labels:  symfony-bundle
gulp-rev-versions-bundle
A bundle that allows symfony to get the version of assets versioned with gulp-rev
Stars: ✭ 13 (-58.06%)
Mutual labels:  symfony-bundle
Victoire
Fullstack Symfony CMS: The perfect mix between a framework and a CMS
Stars: ✭ 227 (+632.26%)
Mutual labels:  symfony-bundle
Csaguzzlebundle
A bundle integrating Guzzle >=4.0 in Symfony
Stars: ✭ 248 (+700%)
Mutual labels:  symfony-bundle
Auditor Bundle
Doctrine audits logs made easy.
Stars: ✭ 221 (+612.9%)
Mutual labels:  symfony-bundle
Monolog Bundle
Symfony Monolog Bundle
Stars: ✭ 2,532 (+8067.74%)
Mutual labels:  symfony-bundle
Enqueue Bundle
[READ-ONLY] Message queue bundle for Symfony. RabbitMQ, Amazon SQS, Redis, Service bus, Async events, RPC over MQ and a lot more
Stars: ✭ 233 (+651.61%)
Mutual labels:  symfony-bundle
Swoole Bundle
Symfony Swoole Bundle
Stars: ✭ 201 (+548.39%)
Mutual labels:  symfony-bundle
symfony-rest-api-bundle
Integrates the MediaMonks REST API Spec in Symfony
Stars: ✭ 17 (-45.16%)
Mutual labels:  symfony-bundle
Gifexceptionbundle
😛 The GhostBuster of your exception page!
Stars: ✭ 197 (+535.48%)
Mutual labels:  symfony-bundle
Schedule Bundle
Schedule Cron jobs (commands/callbacks/bash scripts) within your Symfony application.
Stars: ✭ 216 (+596.77%)
Mutual labels:  symfony-bundle
Fmelfinderbundle
📁 ElFinderBundle provides ElFinder integration with TinyMCE, CKEditor, Summernote editors
Stars: ✭ 231 (+645.16%)
Mutual labels:  symfony-bundle
SonataTimelineBundle
[Abandoned] Integrates SpyTimelineBundle into Sonata
Stars: ✭ 24 (-22.58%)
Mutual labels:  symfony-bundle

Symfony Messenger & API Platform integration

Using a message bus like Symfony Messenger is a wonderful way of structuring your application around commands or queries (which will just be PHP classes). API Platform is a great framework to expose APIs.

The point of this bridge is to enable you to build business actions-centric APIs instead of CRUD APIs. Check this very simple example.

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!

Usage

  1. Get an API Platform application. Easiest is to use Symfony's api pack:

    composer create-project symfony/skeleton api-platform-and-messenger && \
    cd api-platform-and-messenger && \
    composer req api
  2. Install this bridge

    composer req sroze/api-platform-messenger:dev-master
  3. Configure your message(s) to be handled by API Platform like in the following example:

    <?php
    
    namespace App\Message;
    
    use Sam\ApiPlatform\Messenger\Annotation\ApiMessage;
    use Symfony\Component\Validator\Constraints\NotBlank;
    
    /**
     * @ApiMessage(
     *   path="/write-message",
     *   type="command"
     * )
     */
    class WriteMessage
    {
        /**
         * @NotBlank
         *
         * @var string
         */
        public $message;
    }

Reference

@ApiMessage annotation

  • path. The URL path where your command will be exposed.
  • type. The type of message. Can be:
    • query: Will be exposed via a GET method
    • command: Will be exposed via a POST method
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].