dbp / relay-sublibrary-connector-campusonline-bundle
A template bundle for the Relay API gateway
Installs: 6 241
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 1
Type:symfony-bundle
Requires
- php: >=8.1
- ext-json: *
- api-platform/core: ^2.7.11 || ^3.2
- dbp/relay-base-organization-bundle: ^0.2.11
- dbp/relay-core-bundle: ^0.1.148
- dbp/relay-sublibrary-bundle: ^0.4.0
- symfony/config: ^5.4 || ^6.4
- symfony/dependency-injection: ^5.4 || ^6.4
- symfony/event-dispatcher: ^5.4 || ^6.4
- symfony/event-dispatcher-contracts: ^2.5 || ^3
- symfony/framework-bundle: ^5.4 || ^6.4
- symfony/http-kernel: ^5.4 || ^6.4
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.50
- phpstan/phpstan: ^1.10.59
- phpstan/phpstan-phpunit: ^1.3.16
- phpunit/phpunit: ^10.1
- symfony/browser-kit: ^5.4.35 || ^6.4
- symfony/http-client: ^5.4.36 || ^6.4
- symfony/monolog-bundle: ^3.10
- symfony/phpunit-bridge: ^5.4.36 || ^6.4
- vimeo/psalm: ^5.22.2
README
This Symfony bundle can be used as a template for creating new bundles for the DBP Relay project.
When including this bundle into your API server it will gain the following features:
- A custom
./bin/console
command - An example entity
- Various HTTP methods implemented for that entity
TL;DR
The quickest way to make use of this template 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 for more information.
Using the Bundle as a Template
- Copy the repo contents
- Adjust the package name in
composer.json
, in this example we'll pretend you named your bundledbp/relay-your-bundle
- Invent a new PHP namespace and adjust it in all PHP files
- Rename
src/DbpRelaySublibraryConnectorCampusonlineBundle
andDependencyInjection/DbpRelaySublibraryConnectorCampusonlineExtension
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 you can remove that block again):
"repositories": [ { "type": "vcs", "url": "git@gitlab.tugraz.at:dbp/relay/dbp-relay-your-bundle.git" } ],
- Add the bundle package as a dependency:
composer require dbp/relay-your-bundle=dev-main
- Add the bundle to your
config/bundles.php
:
... Dbp\Relay\YourBundle\DbpRelayYourBundle::class => ['all' => true], DBP\API\CoreBundle\DbpCoreBundle::class => ['all' => true], ];
- 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_sublibrary_connector_campusonline.yaml
in the app with the following
content:
dbp_relay_sublibrary_connector_campusonline: example_config: 42 # example_config: '%env(EXAMPLE_CONFIG)%'
The value gets read in DbpRelaySublibraryConnectorCampusonlineExtension
(your extension will be named differently)
and passed when creating the MyCustomService
service.
For more info on bundle configuration see Symfony bundles configuration.
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.
# updates and installs dependencies from dbp/relay-your-bundle
composer update dbp/relay-your-bundle