Skip to content
Snippets Groups Projects
Unverified Commit 5a393a6b authored by Bekerle, Patrizio's avatar Bekerle, Patrizio :fire:
Browse files

Add more development documentation

parent 0d5fad70
No related branches found
No related tags found
No related merge requests found
Pipeline #105831 passed
...@@ -17,38 +17,39 @@ to one command and generate a ready-to-use bundle with the correct naming. ...@@ -17,38 +17,39 @@ to one command and generate a ready-to-use bundle with the correct naming.
See [Generate DBP Symfony bundle](https://dbp-demo.tugraz.at/dev-guide/relay/naming/#generate-dbp-symfony-bundle) for more information. See [Generate DBP Symfony bundle](https://dbp-demo.tugraz.at/dev-guide/relay/naming/#generate-dbp-symfony-bundle) for more information.
## Using the Bundle as a Template ## Using the Bundle as a Template
* Copy the repo contents * Copy the repo contents
* Adjust the package name in `composer.json` * 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 * Invent a new PHP namespace and adjust it in all PHP files
* Rename `src/DbpRelayTemplateBundle` and `DependencyInjection/DbpRelayTemplateExtension` to match the new project name * Rename `src/DbpRelayTemplateBundle` and `DependencyInjection/DbpRelayTemplateExtension` to match the new project name
## Integration into the API Server ## Integration into the API Server
* Add the repository to your composer.json: * 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 ```json
"repositories": [ "repositories": [
{ {
"type": "vcs", "type": "vcs",
"url": "git@gitlab.tugraz.at:dbp/relay/dbp-relay-template-bundle.git" "url": "git@gitlab.tugraz.at:dbp/relay/dbp-relay-your-bundle.git"
} }
], ],
``` ```
* Add the bundle package as a dependency: * Add the bundle package as a dependency:
``` ```bash
composer require dbp/relay-template-bundle=dev-main composer require dbp/relay-your-bundle=dev-main
``` ```
* Add the bundle to your `config/bundles.php`: * Add the bundle to your `config/bundles.php`:
```php ```php
... ...
Dbp\Relay\TemplateBundle\DbpRelayTemplateBundle::class => ['all' => true], Dbp\Relay\YourBundle\DbpRelayYourBundle::class => ['all' => true],
DBP\API\CoreBundle\DbpCoreBundle::class => ['all' => true], DBP\API\CoreBundle\DbpCoreBundle::class => ['all' => true],
]; ];
``` ```
...@@ -57,8 +58,8 @@ DBP\API\CoreBundle\DbpCoreBundle::class => ['all' => true], ...@@ -57,8 +58,8 @@ DBP\API\CoreBundle\DbpCoreBundle::class => ['all' => true],
## Configuration ## Configuration
The bundle has a `secret_token` configuration value that you can specify in your The bundle has a `example_config` configuration value that you can specify in your
app, either by hardcoding it, or by referencing an environment variable. app, either by hard-coding it, or by referencing an environment variable.
For this create `config/packages/dbp_relay_template.yaml` in the app with the following For this create `config/packages/dbp_relay_template.yaml` in the app with the following
content: content:
...@@ -69,11 +70,10 @@ dbp_relay_template: ...@@ -69,11 +70,10 @@ dbp_relay_template:
# example_config: '%env(EXAMPLE_CONFIG)%' # example_config: '%env(EXAMPLE_CONFIG)%'
``` ```
The value gets read in `DbpRelayTemplateExtension` and passed when creating the The value gets read in `DbpRelayTemplateExtension` (your extension will be named differently)
`MyCustomService` service. and passed when creating the `MyCustomService` service.
For more info on bundle configuration see For more info on bundle configuration see [Symfony bundles configuration](https://symfony.com/doc/current/bundles/configuration.html).
https://symfony.com/doc/current/bundles/configuration.html
## Development & Testing ## Development & Testing
...@@ -87,6 +87,6 @@ https://symfony.com/doc/current/bundles/configuration.html ...@@ -87,6 +87,6 @@ https://symfony.com/doc/current/bundles/configuration.html
Don't forget you need to pull down your dependencies in your main application if you are installing packages in a bundle. Don't forget you need to pull down your dependencies in your main application if you are installing packages in a bundle.
```bash ```bash
# updates and installs dependencies from dbp/relay-template-bundle # updates and installs dependencies from dbp/relay-your-bundle
composer update dbp/relay-template-bundle composer update dbp/relay-your-bundle
``` ```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment