Skip to content

Creating a New Bundle

The easiest way to start a new bundle is by using our bundle creator. The API server comes with a command which creates a new bundle according to your specified naming and installs/registers it with your application, so you can start developing/testing right away.

CExecute this command in the console in the directory of the api.

> ./bin/console dbp:relay:maker:make:bundle \
    --vendor myuni \
    --unique-name=my-bundle \
    --friendly-name="My Bundle" \

    Composer Package Name: myuni/relay-my-bundle-bundle
            PHP Namespace: Myuni\Relay\MyBundleBundle
      Symfony Bundle Name: MyuniRelayMyBundleBundle
        Bundle Config Key: myuni_relay_my_bundle
           PHP Class Name: Entity
  API-Platform Short Name: MyBundleEntity
            Resource Path: /my-bundle/entitys
      Serialization Group: MyBundleEntity:some-group
             Open API Tag: My Bundle
      GIT Repository Name: myuni-relay-my-bundle-bundle
Continue? (y/n)

* The package 'myuni/relay-my-bundle-bundle' was created under 'bundles/myuni-relay-my-bundle'
* The package was added to your composer.json and installed
* The containing bundle was registered with your application

This will create a new composer package under ./bundles, register it in your composer.json and register the containing bundle in your bundles.php. After restarting the server you will see example API endpoints added by the bundle.

Publishing your Bundle

Ideally at some point in the future you will want to share your bundle publicly, so other users can install and benefit from it as well. For this you need to

If you just want to extract the package, but don't want to publish it publicly you can also install from a private git repository instead. See for more information.

Further Information