modera/backend-on-steroids-bundle
Composer 安装命令:
composer require modera/backend-on-steroids-bundle
包简介
Bundle makes it easier to optimize MJR based backend's loading speed for up to 50%.
README 文档
README
Bundle makes it easier to optimize backend's loading speed for up to 50%, it does it in several ways:
- Provides console commands which can generate shell scripts which can be used to compile all bundle's extjs classes together using Sencha Cmd. Using these scripts you will use Sencha Cmd without the need to learn how to use and configure it, it will be done for you behind the scene. NB! Generated scripts rely on Docker!
- Ships a special resources-loader which makes it possible to automatically detect and include
MJR.js and a javascript file which is compiled from bundles' javascript extjs-classes (with default configuration
it is named
bundles.js). - Using a semantic configuration makes it possible to mark certain bundles (using regex-like syntax) and their javascript files as non-blocking resources. This is especially useful when there're bundles whose assets are not designated as non-blocking but in fact they are and you want to override this behaviour, make them load asynchronously.
Installation
Add this dependency to your composer.json:
"modera/backend-on-steroids-bundle": "~1.0"
Update your AppKernel class and add ModeraBackendOnSteroidsBundle declaration there:
new Modera\BackendOnSteroidsBundle\ModeraBackendOnSteroidsBundle()
Documentation
Once you have installed the bundle please use modera:backend-on-steroids:generate-scripts command, once
executed it will generated four shell scripts for you:
steroids-setup.sh- This script will prepare an extjs workspace for you that will be used to compile your assets using Sencha Cmdsteroids-compile-bundles.sh- Once you have steroids set up and your extjs classes copied (usemodera:backend-on-steroids:copy-classes-to-workspacefor that) you can invoke this command and have all your installation extjs classes will be compiled together, the result, if no configuration changed, will copied toweb/backend-on-steroids/bundles.jsfile.steroids-compile-mjr.sh- compiles MJR for you and places it, if no semantic configuration is modified, toweb/backend-on-steroids/MJR.jssteroids-cleanup.sh- If you don't anymore need extjs-workspace then you can use this script and it will delete all developers files that were created to setup extjs-workspace (your compiled extjs classes won't be touched)
See Modera\BackendOnSteroidsBundle\DependencyInjection\Configuration for a full list of available configuration
properties.
In order to make your extjs classes visible to modera:backend-on-steroids:copy-classes-to-workspace, you need to contribute
to modera_backend_on_steroids.extjs_classes_paths extension-point or if you are not going to distribute your bundles
you can use modera_backend_on_steroids/compiler/path_patterns configuration property.
Typical workflow
- $
app/console modera:backend-on-steroids:generate-scripts - Make generated scripts executable (when
modera:backend-on-steroids:generate-scriptsis executed required shell command is printed that you can use) - $
./steroids-setup.sh - $
app/console modera:backend-on-steroids:copy-classes-to-workspace - $
./steroids-compile-bundles.sh - $
./steroids-compile-mjr.sh
Once this steps are completed, given that you haven't changed this bundle's semantic configuration
compiler/path_patterns property), when you refresh backend you should see that MJR.js and bundles.js are
automatically included using "script" tags. Script steroids-setup.sh you need to execute only once per
foundation installation or after you have used steroids-cleanup.sh.
Troubleshooting
Sencha Cmd not finding classes
If, while executing ./steroids-compile-bundles.sh you are getting BUILD FAILED similar to this one:
[ERR] BUILD FAILED
[ERR] com.sencha.exceptions.ExBuild: Failed to find any files for /var/www/packages/bundles/src/MyCompany/mypackage/CustomerHistory.js::ClassRequire::MyCompany.mypackage.CustomerHistoryActivity
[ERR]
[ERR] Total time: 21 seconds
[ERR] The following error occurred while executing this line:
/var/www/packages/bundles/.sencha/package/build-impl.xml:137: The following error occurred while executing this line:
/var/www/packages/bundles/.sencha/package/js-impl.xml:32: com.sencha.exceptions.ExBuild: Failed to find any files for
/var/www/packages/bundles/src/MyCompany/mypackage/CustomerHistory.js::ClassRequire::MyCompany.mypackage.CustomerHistoryActivity
It means that your file, which in this case is located at /var/www/packages/bundles/src/MyCompany/mypackage/CustomerHistory.js
is referencing a class MyCompany.mypackage.CustomerHistoryActivity which Sencha Cmd compiler cannot find. This usually
means one of two things:
modera:backend-on-steroids:copy-classes-to-workspacecommand didn't find a directory whereMyCompany.mypackage.CustomerHistoryActivityis located and therefore could not properly prepare steroids' workspace. To solve this problem you need to find where CustomerHistoryActivity.js file is located and updatemodera_backend_on_steroids/path_patternsconfiguration property. For more details please see\Modera\BackendOnSteroidsBundle\DependencyInjection\Configuration. Once configuration property is updated, don't forget to runmodera:backend-on-steroids:copy-classes-to-workspaceagain. If you checked your project and still couldn't findCustomerHistoryActivity.jsfile anywhere, chances are that you are dealing with the second case:CustomerHistoryActivityclass has been deleted, but developer simply forgot to updateCustomerHistoryclass to removeCustomerHistoryActivityfrom its dependencies. In this case what you need to do is to openCustomerHistory.jsfile, locate itsrequiresor similar dependency declaration block and removeCustomerHistoryActivityfrom there. Once its done you can runmodera:backend-on-steroids:copy-classes-to-workspaceand then./steroids-compile-bundles.sh.
Licensing
This bundle is under the MIT license. See the complete license in the bundle: Resources/meta/LICENSE
modera/backend-on-steroids-bundle 适用场景与选型建议
modera/backend-on-steroids-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 58.48k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 09 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 modera/backend-on-steroids-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 modera/backend-on-steroids-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 58.48k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 24
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-09-15