common-gateway / first-registration-bundle
创建 symfony flex 插件包的示例
Requires
- php: >=7.4
- commongateway/corebundle: ^1.1.110 | <2.0
Requires (Dev)
- symfony/dependency-injection: ~3.4|~4.1|~5.0
README
此插件为 VrijBRP 应用程序提供 Eerste Inschrijving
功能。
第一部分是关于安装插件的内容,后一部分是关于扩展 Common Gateway 功能的自定义插件。
使用 Common Gateway 管理用户界面进行安装
一旦正确设置了包(如本仓库所示),Common Gateway 可以在不进行额外配置的情况下发现该包。转到 插件
标签以搜索、选择和安装插件。
使用 PHP 命令进行安装
要执行以下命令,您需要 Composer 或已安装 PHP 和 Composer 的 dockerized 安装。
在终端和根目录下的 Composer 方法
用于安装插件
$composer require common-gateway/pet-store-bundle:dev-main
用于安装模式
`$php bin/console commongateway:install common-gateway/pet-store-bundle
在终端和根目录下的 dockerized 方法
用于安装插件
$docker-compose exec php composer require common-gateway/pet-store-bundle:dev-main
用于安装模式
$docker-compose exec php bin/console commongateway:install common-gateway/pet-store-bundle
创建您的插件包
本节是为那些希望在不对核心代码库进行添加的情况下构建扩展 Common Gateway 功能的插件的开发者准备的。
以下知识假设和/或已安装
Composer Packagist Docker Schema.json 基本了解 Common Gateway
使用此模板
此模板用于快速进行 Symfony 插件包开发,并旨在作为基于您的自定义插件的模型。按照以下步骤,在 45 分钟或更短的时间内创建您的插件
-
在 GitHub 上登录
-
使用 此模板
-
命名您的插件包(驼峰式)。根据 Symfony 命名约定,包需要以
Bundle
结尾。 -
点击绿色按钮
从模板创建仓库
-
更新文件名和命名空间以适应您的需求
- 打开 composer.json,并将其名称更改为您的合适名称。第一个词应该是命名空间,第二个是包名。
注意:这是破折号式。也请阅读:命名您的包
- 检查 autoload 字段是否已正确设置。
- 打开 PetStoreBundle.php,并将 Bundle
name
和namespace
更改为合适的名称。命名空间应与composer.json
中的包名相同,但为驼峰式。所以common-gateway/pet-store-bundle
变为CommonGateway/FirstRegistrationBundle
- 相应地重命名
/Service
和/ActionHandler
(如果未使用,则删除)。 - 将
/DependencyInjection/PetStoreExtension.php
重命名为您的BundleNameExtension.php
- 重命名
/Resources/config/services.yaml
命名空间
添加模式
您可以从您的 json schemas 文件夹中加载实体,用于在 Common Gateway 中使用,并根据您的模式处理对象。
您可以添加现有的模式或创建自己的模式,并将它们添加到 /Schema
文件夹中。这里有一个示例,请参考 /Schema/example.json
。
以下属性是必需的,如果没有它们,网关将无法识别该模式为有效。
- `version` can start on '0.1.0.'
没有此属性,您无法更新方案。
- `$schema` (https://docs.commongateway.nl/schemas/Entity.schema.json)
- `$id` (https://example.com/schema/{Your scheme name}.schema.json)
唯一的
$id
可以与其他模式相关联。
- `type` must be 'object'
- `properties` must be schema properties
一旦将模式添加到仓库中,您还可以为这些模式添加对象/数据。示例请参考 /Data
文件夹。