zero1/magento2-release-library
Composer 安装命令:
composer require zero1/magento2-release-library
包简介
关键字:
README 文档
README
A module to provided easy to use functions in updgrade/install scripts
Usage
To use the functions in your setup or install script add the util class to your objects constructor
/** @var \Zero1\ReleaseLibrary\Utility **/ protected $setupUtility; public function __construct( \Zero1\ReleaseLibrary\Utility $setupUtility ){ $this->setupUtility = $setupUtility; }
You will then be able to call $this->setupUtility.
Functions
Create / Update a custom variable
$this->setupUtility->createCustomVariable( 'Variable Code, 'Variable Name', 'HTML Value', 'Plain Value' );
You can also supply a 5th argument:
true- update if variable if one with the same code already existsfalse- throw a EntityAlreadyExistsException if a variable with the same code exists
Move a category
$this->setupUtility->moveCategory( CATEGORY_ID_TO_MOVE MOVE_TO_THIS_CATEGORY_ID, );
You can also supply a 3rd argument "after", if you would like the moved category to be placed after a specific category.
Create CMS Blocks
This allows you to create a number of CMS Blocks without needing to add the html into your setup script.
Configuration
Before being able to do this you must create another module or use your current release module.
This module must contain the directory block_source
Example
In this example I have a module called "My_ReleaseModule" which contains:
My_ReleaseModule/
block_source/
1.0.0/
a-new-custom-block.html
1.0.1/
custom-block.html
promo-block.html
// configure setup utility to use my module $this->setupUtility->setSourceModule('My_ReleaseModule); // create all the blocks in `1.0.1` $this->setupUtility->createBlocksFromDir( $this->setupUtility->getBlockSourceDirectory().'/1.0.1/' );
This will result in two cms blocks being created 1.
- name: custom block
- id: custom-block
- name: promo block
- id: promo-block
Create CMS Pages
This allows you to create a number of CMS Pages without needing to add the html into your setup script.
Configuration
Before being able to do this you must create another module or use your current release module.
This module must contain the directory page_source
Example
In this example I have a module called "My_ReleaseModule" which contains:
My_ReleaseModule/
page_source/
1.0.0/
a-new-cms-page.html
1.0.1/
custom-page.html
contact-us.html
// configure setup utility to use my module $this->setupUtility->setSourceModule('My_ReleaseModule); // create all the pages in `1.0.1` $this->setupUtility->createPagesFromDir( $this->setupUtility->getPageSourceDirectory().'/1.0.1/' );
This will result in two cms pages being created 1.
- name: custom page
- id: custom-page
- name: contact us
- id: contact-us
Set Config
Update / set config values
Example 1 - set single value
$this->setupUtility->setConfig( [['design/head/demonotice', 1]], 'default', 0 );
Example 2 - set multiple values for default scope
$this->setupUtility->setConfig([ ['design/head/demonotice', 1], ['web/cookie/cookie_httponly', 1] ]);
Example 3 - set multiple values for multiple scopes
$this->setupUtility->setConfig([ ['design/head/demonotice', 1], // will be set at default ['web/cookie/cookie_httponly', 1] // will be set at default ['web/cookie/cookie_path', '/', 'stores', 1], // will be set for store 1 ['web/cookie/cookie_path', '/', 'stores', 2], // will be set for store 2 ]);
Update Email Templates
Update email template with ID of $templateId, with content from the file at $newTemplateContentPath.
$this->setupUtility->updateEmailTemplate($templateId, function($template){
/** @var \Magento\Email\Model\BackendTemplate $template */
$template->setTemplateText(
file_get_contents($newTemplateContentPath)
);
return $template;
});
You can update as many/few things as you like.
zero1/magento2-release-library 适用场景与选型建议
zero1/magento2-release-library 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.27k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2020 年 04 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「install」 「magento」 「setup」 「magento 2」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 zero1/magento2-release-library 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 zero1/magento2-release-library 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 zero1/magento2-release-library 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Install Plugin for NetCommons3
Provides a module to easily configure main aspects from a website.
Composer plugin for running post-install/post-update scripts of your project's dependencies
Arikam CMS installers
Magento 2 Social Login extension is designed for quick login to your Magento 2 store without procesing complex register steps
Collection of tools to use the full power of the Enyalius framework
统计信息
- 总下载量: 5.27k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2020-04-22