API Platform Microservice Bundle

Installs: 16 672

Dependents: 0

Suggesters: 0

Security: 0

Stars: 55

Watchers: 3

Forks: 6

Open Issues: 2


v0.4.0 2022-01-07 09:29 UTC

This package is auto-updated.

Last update: 2022-11-10 19:16:27 UTC


Packagist GitHub Actions Status

A Microservice tools bundle for API Platform.

A microservice bundle ?

In a microservice context where each microservices are API Platform instances, each instance must behave as an API Platform data producer and an API Platform data consumer.

But API Platform isn't intended to behave like a client.

Therefore, here comes the API Platform Microservice Bundle!

This bundle intents to provide a set of tools to ease the development of client behaving microservices by trying to abstract the http call layer.

Getting started


You can easily install API Platform Microservice bundle by composer

$ composer require mtarld/api-platform-ms-bundle

Then, bundle should be registered. Just verify that config\bundles.php is containing :

Mtarld\ApiPlatformMsBundle\ApiPlatformMsBundle::class => ['all' => true],


Once the bundle is installed, you should configure it to fit your needs.

To do so, edit config/packages/api_platform_ms.yaml and config/routes/api_platform_ms.yaml

# config/packages/api_platform_ms.yaml

    # HttpClient that will be used internally (default: 'Symfony\Contracts\HttpClient\HttpClientInterface')
    http_client: ~

    # Name of the current microservice (required)
    name: client

    # Option to log request (default '%kernel.debug%')
    log_request: true

    # Host used for microservice dynamic routes generation (default: [])
        - https://client.api

    # List of related microservices
        # Microservice name
            # Microservice base uri (required)
            base_uri: https://product.api

            # Microservice API path (default: '')
            api_path: /api

            # Microservice format (required)
            # Supported formats: jsonld, jsonhal, jsonapi
            format: jsonld
# config/routes/api_platform_ms.yaml

    resource: '@ApiPlatformMsBundle/Resources/config/routes.xml'
    prefix: /api

And you're ready to go ! 🚀

Provided tools

Supported microservice formats

Currently, API Platform supported formats are:

  • jsonld
  • jsonapi
  • jsonhal


Please read for details on our code of conduct, and the process for submitting pull requests to us.

After writing your fix/feature, you can run following commands to make sure that everything is still ok.

# Install dev dependencies
$ composer install

# Running tests locally
$ make test


  • Mathias Arlaud - mtarld - <mathias(dot)arlaud@gmail(dot)com>