melisplatform/melis-platform-framework-symfony
Composer 安装命令:
composer require melisplatform/melis-platform-framework-symfony
包简介
README 文档
README
This bundle is the gateway for Symfony in order to make a connection to Melis platform like accessing the registered services and automatically use the database connection of the platform.
Getting Started
These instructions will get you a copy of the project up and running on your machine.
Prerequisites
You will need to install the following in order to have this module running:
- melisplatform/melis-platform-frameworks
It will automatically be done when using composer.
Installing
Run the composer command:
composer require melisplatform/melis-platform-framework-symfony
Running the code
Activating the module
Activating this bundle is just the same way you activate your bundle inside symfony application. You just need to include its bundle class to the list of bundles inside symfony application (most probably in bundles.php file).
return [
//All of the symfony activated bundles here
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
...
...
etc.
//Melis Platform Custom Bundles
MelisPlatformFrameworkSymfony\MelisPlatformFrameworkSymfonyBundle::class => ['all' => true]
];
Accessing Melis Platform Service
MelisServiceManager Class
- This class is the gateway for Symfony in order to make a connection to Melis platform. Therefore, using this class we can get all of Melis platform registered services.
- You can call this class inside symfony application as a service by calling its registered
service key
melis_platform.service_manageror by using a Dependency Injection. (See example below)
Example:
//Using Dependency Injection
//Assuming we are inside a controller
protected $melisServiceManager;
//Inject MelisServiceManager in the controller constructor function
public function __construct(MelisServiceManager $melisServiceManager)
{
$this->melisServiceManager = $melisServiceManager;
}
//And then we can use the melis provider like this
//to get the language list of the Back Office
$melisCoreTableLang = $this->melisServiceManager->getService('MelisCoreTableLang');
$melisCorelangList = $melisCoreTableLang->fetchAll()->toArray();
//Using service key (melis_platform.service_manager)
//Assuming we are inside of any custom Symfony controller that extends AbstractController of Symfony
//Calling the service
$melisServices = $this->get('melis_platform.service_manager');
//Calling the MelisCoreTableLang service registered in Melis Platform
$languageTable = $melisServices->getService('MelisCoreTableLang');
//Calling fetchAll function inside MelisCoreTableLang service and convert the result to array
$languageList = $languageTable->fetchAll()->toArray();
-
Bundles that are inside the Symfony skeleton might have a problem accessing the
melis_platform.service_managerservice key inside their Controller that extends AbstractController since AbstractController only uses a limited container that only contains some services.But we can still use the
melis_platform.service_managerservice key by overriding thegetSubscribedServicesfunction of the AbstractController inside our Controller to register our service.
public static function getSubscribedServices()
{
return array_merge(parent::getSubscribedServices(),
[
'melis_platform.service_manager' => MelisServiceManager::class,
]);
}
Event Listeners
DatabaseSwitcherListener
- This listener will force Symfony to use the Melis Platform database.
SymfonyTranslationsListener
- This listener will get all of Symfony translations and store it inside a file (Resources/translations/melis/symfony-translations.phtml) so that Melis Platform can use this translations. This file MUST be writable.
Authors
- Melis Technology - www.melistechnology.com
See also the list of contributors who participated in this project.
License
This project is licensed under the OSL-3.0 License - see the LICENSE
melisplatform/melis-platform-framework-symfony 适用场景与选型建议
melisplatform/melis-platform-framework-symfony 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 493 次下载、GitHub Stars 达 1, 最近一次更新时间为 2019 年 08 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「zf2」 「module」 「cms」 「melis」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 melisplatform/melis-platform-framework-symfony 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 melisplatform/melis-platform-framework-symfony 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 melisplatform/melis-platform-framework-symfony 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
LosLog provides some log utility
GraphQL authentication for your headless Craft CMS applications.
EdpModuleLayouts is very simple Laminas module for making module-specific layouts insanely easy.
Set Links with a specific language parameter
Supercharged text field validation.
Zend Framework module to leverage the symfony dependency injection container
统计信息
- 总下载量: 493
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: OSL-3.0
- 更新时间: 2019-08-29