diff --git a/README.md b/README.md index f22bbb87bb80752d8d2898119b2eb15f88f5aae5..5ab197970297c4734102817159140c87f34b10b6 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,9 @@ [GitLab](https://gitlab.tugraz.at/dbp/relay/dbp-relay-example-bundle) | [Packagist](https://packagist.org/packages/dbp/relay-example-bundle) -This Symfony bundle can be used as an example for creating new bundles for the -DBP Relay project. +The goal of this bundle is to include a wide variety of features that you might +need in developing your own bundle. So you can use it as either a reference, or +as a starting point/sandbox for experiments. When including this bundle into your API server it will gain the following features: @@ -12,84 +13,19 @@ features: * A custom `./bin/console` command * An example entity * Various HTTP methods implemented for that entity +* A custom controller for that entity +* A health check +* ... -## TL;DR - -The quickest way to make use of this example bundle is to feed your desired names -to one command and generate a ready-to-use bundle with the correct naming. - -See [Generate DBP Symfony bundle](https://dbp-demo.tugraz.at/handbook/relay/dev/naming/#generate-dbp-symfony-bundle) for more information. - -## Using the Bundle as an example - -* Copy the repo contents -* Adjust the package name in `composer.json`, in this example we'll pretend you named your bundle `dbp/relay-your-bundle` -* Invent a new PHP namespace and adjust it in all PHP files -* Rename `src/DbpRelayExampleBundle` and `DependencyInjection/DbpRelayExampleExtension` to match the new project name - -## Integration into the API Server - -* Push your bundle on a git server, in this example we'll use `git@gitlab.tugraz.at:dbp/relay/dbp-relay-your-bundle.git` -* Add the repository to your composer.json (as soon as you published your bundle to [Packagist](https://packagist.org/) - you can remove that block again): - -```json - "repositories": [ - { - "type": "vcs", - "url": "git@gitlab.tugraz.at:dbp/relay/dbp-relay-your-bundle.git" - } - ], -``` - -* Add the bundle package as a dependency: +Integrate it into your server via: ```bash -composer require dbp/relay-your-bundle=dev-main -``` - -* Add the bundle to your `config/bundles.php`: - -```php -... -Dbp\Relay\YourBundle\DbpRelayYourBundle::class => ['all' => true], -DBP\API\CoreBundle\DbpCoreBundle::class => ['all' => true], -]; +composer require dbp/relay-example-bundle ``` -* Run `composer install` to clear caches - -## Configuration - -The bundle has a `example_config` configuration value that you can specify in your -app, either by hard-coding it, or by referencing an environment variable. - -For this create `config/packages/dbp_relay_example.yaml` in the app with the following -content: - -```yaml -dbp_relay_example: - example_config: 42 - # example_config: '%env(EXAMPLE_CONFIG)%' -``` - -The value gets read in `DbpRelayExampleExtension` (your extension will be named differently) -and passed when creating the `MyCustomService` service. - -For more info on bundle configuration see [Symfony bundles configuration](https://symfony.com/doc/current/bundles/configuration.html). - ## Development & Testing * Install dependencies: `composer install` * Run tests: `composer test` * Run linters: `composer run lint` * Run cs-fixer: `composer run cs-fix` - -## Bundle dependencies - -Don't forget you need to pull down your dependencies in your main application if you are installing packages in a bundle. - -```bash -# updates and installs dependencies from dbp/relay-your-bundle -composer update dbp/relay-your-bundle -```