common-gateway / pet-store-bundle
An example package for creating symfony flex bundles as plugins
Installs: 22
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=7.4
- common-gateway/customer-notifications-bundle: ^0.0.40 | < 1.0
- commongateway/corebundle: ^1.2.68 | <2.0
Requires (Dev)
- symfony/dependency-injection: ~3.4|~4.1|~5.0
- dev-main
- 0.0.85
- 0.0.84
- 0.0.83
- 0.0.82
- 0.0.81
- 0.0.80
- 0.0.79
- 0.0.78
- 0.0.77
- 0.0.76
- 0.0.75
- 0.0.74
- 0.0.73
- 0.0.72
- 0.0.71
- 0.0.70
- 0.0.69
- 0.0.68
- 0.0.67
- 0.0.66
- 0.0.65
- 0.0.64
- 0.0.63
- 0.0.62
- 0.0.61
- 0.0.60
- 0.0.59
- 0.0.58
- 0.0.57
- 0.0.56
- 0.0.55
- 0.0.54
- 0.0.53
- 0.0.52
- 0.0.51
- 0.0.50
- 0.0.49
- 0.0.48
- 0.0.47
- 0.0.46
- 0.0.45
- 0.0.44
- 0.0.43
- 0.0.42
- 0.0.41
- 0.0.40
- 0.0.39
- 0.0.38
- 0.0.37
- 0.0.36
- 0.0.35
- 0.0.34
- 0.0.33
- 0.0.32
- 0.0.31
- 0.0.30
- 0.0.29
- 0.0.28
- 0.0.27
- 0.0.26
- 0.0.25
- 0.0.24
- 0.0.23
- 0.0.22
- 0.0.21
- 0.0.20
- 0.0.19
- 0.0.18
- 0.0.17
- 0.0.16
- 0.0.15
- 0.0.14
- 0.0.13
- 0.0.12
- 0.0.11
- 0.0.10
- 0.0.9
- 0.0.8
- 0.0.7
- 0.0.6
- 0.0.5
- 0.0.4
- 0.0.3
- 0.0.2
- 0.0.1
- dev-featue/schema-to-puml
- dev-feature/xz-45/code-sniffer
- dev-MWest2020-patch-1
This package is auto-updated.
Last update: 2024-11-15 12:02:34 UTC
README
This repository is for creating PHP Symfony flex bundles. The Common Gateway ecosystem uses this template for rapid development to extend Gateway functionlity outside of the Core.
The first section is about installing plugins. The latter part is about custom plugins to extend Common Gateway functionality.
Installation with the Common Gateway admin user-interface
Once a bundle is set up correctly (like this repository), the Common Gateway can discover the bundle without additional configuration. Head to the Plugins
tab to search, select and install plugins.
Installing with PHP commands
To execute the following command, you will need Composer or a dockerized installation that already has PHP and Composer.
The Composer method in the terminal and root folder:
for the installation of the plugin
$composer require common-gateway/pet-store-bundle:dev-main
for the installation of schemas
$php bin/console commongateway:install common-gateway/pet-store-bundle
The dockerized method in the terminal and root folder:
for the installation of the plugin
$docker-compose exec php composer require common-gateway/pet-store-bundle:dev-main
for the installation of schemas
$docker-compose exec php bin/console commongateway:install common-gateway/pet-store-bundle
Creating your Bundle
This section is for developers who want to build plugins to extend Common Gateway functionality without adding to the core codebase.
The following knowledge is assumed and/or installed:
- Composer
- Packagist
- Docker
- Schema.json
- Basic knowledge of the Common Gateway & Core Bundle
Using this template
This template is for rapid Symfony bundle development and meant as a model to base your custom plugin on. Follow the next steps to create your plugin within 45 minutes or less
-
Login on GitHub
-
Use this template
-
Name your Bundle (CamelCase). The bundle needs to end with
Bundle
as per Symfony naming conventions. -
Press the green button
Create repository from template
-
Update file names and namespace to your fitting :
- Open composer.json, and change the name to your fitting. The first word should be the namespace, and the second the bundle's name.
Note: this is kebab-case. Also read: naming your package
- Check the autoload field to be set accordingly.
- Open PetStoreBundle.php and change the Bundle
name
andnamespace
. The namespace should be the same as your package name incomposer.json
but in CamelCase. Socommon-gateway/pet-store-bundle
becomesCommonGateway/PetStoreBundle
- Rename the
/Service
and/ActionHandler
accordingly (or delete if not used). - Rename the
/DependencyInjection/PetStoreExtension.php
to yourBundleNameExtension.php
- Rename the
/Resources/config/services.yaml
namespaces
Adding schemas
You can load json schemas as Entities from your /Schema
folder to use in the Common Gateway and work with objects based on your schemas.
You can add existing schemas or create your own and add them to the/Schema
folder. There is an example shown here in /Schema/example.json
.
The following properties are required, and without them, the Gateway won't recognize the schema as valid:
- `version` can start on '0.1.0.'
without this property, you can't update schemes
- `$schema` (https://docs.commongateway.nl/schemas/Entity.schema.json)
- `$id` (https://example.com/schema/{Your scheme name}.schema.json)
Unique
$id
to be relatable to other schemas.
- `type` must be 'object'
- `properties` must be schema properties
Once you add schemas to the repository, you can also add objects/data for those schemas. There is an example shown in the /Installation/Data
folder.