melisplatform/melis-platform-frameworks
Composer 安装命令:
composer require melisplatform/melis-platform-frameworks
包简介
Melis Platform Frameworks
README 文档
README
This Module handles the execution of Third party framework and return the content as response of the request, it also provides a Service in order to make a request to the third party.
Prerequisites
This module requires melisplatform/melis-core installed.
This will automatically be done when using composer.
Installing
composer require melisplatform/melis-platform-frameworks
Adding Third Party Frameworks
Third Party Frameworks are located at the root of Melis Platform application /thirdparty,
inside this directory you can place your desired Frameworks.
Framework skeletons for Melis Platform can be downloaded here:
Laravel,
Symfony,
Lumen,
Silex
...
/module
/public
/storage
/test
/thirdparty
/Laravel
/app
/bootstrap
/config
...
/Symfony
/bin
/config
/public
...
...
Above is an example of Laravel and Symfony frameworks added to /thirdparty directory.
Note: You can decide what would be the name of the framework directory name
and then apply it on your configuration below.
Third Party Framework Execution
When executing the third party framework a config data MUST be declared in the config file in order to determine the application to be executed, this can be done by adding this data array on the config file:
'third-party-framework' => [
'index-path' => [
'Laravel/public/index.php'
]
],
'index-path' must set the path of the application index.php file inside /thirdparty in the root directory.
For example 'Laravel/public/index.php'. DO NOT include the /thirdparty directory in the path.
Third Party Frameworks modification
Frameworks response MUST be modified to return the response content and the status of the request, here's an example of Laravel framework integration as third party framework.
Laravel public/index.php
At the last part of the code in public/index.php file, Laravel is generating the response by calling $response->send() method
from Response Object then after terminated the application by $kernel->terminate($request, $response), as code syntax below:
...
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
$response->send();
$kernel->terminate($request, $response);
In the integration of third party framework instead of displaying the response and terminating in the index.php file,
this will return an array of data containing the content using getContent() and status getStatusCode() from Response object.
...
// $response->send();
// $kernel->terminate($request, $response);
return [
'statusCode' => $response->getStatusCode(),
'content' => $response->getContent(),
];
Notice the $response->send() and $kernel->terminate($request, $response) are commented
to avoid rendering the response and terminating the application.
Service and implementation
This module has a service MelisPlatformService to call in order to get a response from
third party framework. By specifying the route of the request it will execute a request and
return the content as the result.
Example:
$thirdPartySrv = $this->getServiceManager()->get('MelisPlatformService');
$thirdPartySrv->setRoute('/melis/lravel-list');
$response = $thirdPartySrv->getContent();
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.md file for details
melisplatform/melis-platform-frameworks 适用场景与选型建议
melisplatform/melis-platform-frameworks 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 994 次下载、GitHub Stars 达 1, 最近一次更新时间为 2019 年 08 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「zf2」 「module」 「cms」 「melis」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 melisplatform/melis-platform-frameworks 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 melisplatform/melis-platform-frameworks 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 melisplatform/melis-platform-frameworks 相关的其它包
同方向 / 同关键字的高下载量 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
统计信息
- 总下载量: 994
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 8
- 依赖项目数: 11
- 推荐数: 0
其他信息
- 授权协议: OSL-3.0
- 更新时间: 2019-08-29