common-gateway/brp-bundle
Composer 安装命令:
composer require common-gateway/brp-bundle
包简介
An example package for creating symfony flex bundles as plugins
README 文档
README
An example repository for creating php symfony flex bundles
Using this bundle
Installing with common-gateway admin user-interface
@todo!
Installing with php commands
To execute the following command you will need Composer or a dockerized installation which already haves php and composer.
U can install this plugin by installing with command:
composer require common-gateway/open-catalogi-bundle:dev-main or dockerized: docker-compose exec php composer require common-gateway/open-catalogi-bundle:dev-main
in the directory where your composer.json lives.
If you also want to install the schemas as entities you can install them with command:
php bin/console commongateway:install [common-gateway/open-catalogi-bundle] or dockerized: docker-compose exec php bin/console commongateway:install [common-gateway/open-catalogi-bundle]
Creating your own bundle
Requirements
- GitHub account or organization
- Packagist account
- Composer or if your project is dockerized, Docker Desktop
Using this template
To create your own symfony bundle. You can copy this repository for a fast start.
- Login on GitHub
- Use this template
- Name your bundle (CamelCase)
- 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 name of your bundle. Check the autoload field to be set accordingly. Note: this is kebab-case. Also read: naming your package
- Open BRPBundle.php and change the Bundle name and namespace. The namespace should be the same as your package name in composer.json but in CamelCase. So common-gateway/pet-store-bundle becomes CommonGateway/BRPBundle
- Rename the /Service and /ActionHandler accordingly (or delete if not used).
- Rename the /DependencyInjection/BRPBundleExtension.php to your BundleNameExtension.php
- Rename the /Resources/config/services.yaml namespaces
Adding schemas
If you use your bundel with the common-gateway, you can add your own schemas that will be loaded as Entities. These Entities will be loaded into the database so you can work with your own objects/data.
These schemas are json schema's.
You can add existing schemas or create your own and add them in /Schema. There is also an example as /Schema/example.json.
Make sure your schema's have a version property so you can update your schema's!
Also make sure they have a unique $id so that they can be related to other schema's.
If you have added schema's you can also add objects/data for them, in /Data is an example you can use.
Upload to packagist
Before we can use our bundle and code, we must have it online on packagist so we can install with composer.
- Upload to packagist
- Go to Packagist
- Press
submitin the top menu bar and paste your bundle's github repository link, the name from you composer.json will be used as package name. - If valid press
Submit
- Auto-update package
- Go to your packagist profile.
- Press
Show API Tokenand copy - Go to your new bundle's github repository
- Go to your repository settings
- Go to webhooks, and press
Add webhook - As Payload URL, set https://packagist.org/api/github?username=yourPackagistUsername
- Keep SSL verification enabled
- As secret, paste the copied API token from packagist
- Set event on
Just push the event - Press
Add webhook - If you push new code it will now push to packagis. On packagist you should not see the auto-update warning anymore. If its still there check if your username and secret are set properly on the github webhook.
Using your code
To use the code in your library we first have to install it with composer.
Note: for docker add docker-compose exec php before all commands
- Navigate with a command line to where your composer.json lives in the project you want to use this bundle.
- Execute
composer require {full package name}:dev-main - Docker users: restart your containers so symfony can recognize the new Bundle's namespace
- Execute
- Open a php file where you want to use a class.
- Add the correct use statement (example
use CommonGateway\BRPBundle\Service\BRPBundleService;) - U can now use your class!
- Add the correct use statement (example
In the common gateway, if you want to use your code when triggered by an event with a action, make sure the class of the action object is set as the handler name including the namespace. For example if I want to use the BRPBundleService I can set the BRPBundleHandler as CommonGateway\BRPBundle\ActionHandler\BRPBundleHandler.
common-gateway/brp-bundle 适用场景与选型建议
common-gateway/brp-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.16k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 12 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「symfony」 「gateway」 「common」 「conduction」 「commongateway」 「common-gateway-plugin」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 common-gateway/brp-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 common-gateway/brp-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 common-gateway/brp-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
repository php library
Payyo Gateway for the Omnipay payment processing library
The bundle for easy using json-rpc api on your project
Provides common functionality and classes for Serenata.
Common libraries used by Zimbra Api
Bundle Symfony DaplosBundle
统计信息
- 总下载量: 1.16k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 13
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: EUPL-1.2
- 更新时间: 2022-12-01