presta-expert/module-helper
Composer 安装命令:
composer require presta-expert/module-helper
包简介
Helper which you may use when creating your custom modules instead of using standard prestashop Module class
README 文档
README
An abstract class which you may use when creating your custom modules instead of using standard prestashop Module class.
It implements some features that allows you to create modules in a more schematic way without unnecessarily repeating the code.
I plan to add more options in the future including simplification for creating controllers, forms, tables etc.
Requirements
- PHP >= 5.2.4
- Prestashop 1.5 - 1.7
Installation
Composer (recommended)
$ composer require presta-expert/module-helper
Basic usage
<?php /** * Checking if module is executed in prestashop context */ if (!defined('_PS_VERSION_')) { exit; } /** * Loading composer autoload */ require __DIR__ . '/vendor/autoload.php'; /** * Your module description */ class MyCustomModule extends \PrestaExpert\Helper\AbstractModule { /** * Setting your module details */ public function __construct() { $this->name = 'mycustommodule'; $this->version = '1.5.2'; $this->author = 'Johnny Sins'; $this->tab = 'analytics_stats'; parent::__construct(); $this->displayName = $this->l('My custom module'); $this->description = $this->l('My custom module full description'); } /** * {@inheritdoc} * * Below configuration values will be automatically * added on module installation * * Also below values will be automatically deleted * on module uninstallation */ public function getConfiguration() { return array( 'MY_CUSTOM_CONFIG_1' => 'Lorem', 'MY_CUSTOM_CONFIG_2' => 'Lorem ipsum', ); } /** * {@inheritdoc} * * Below hooks will be automatically registered on * module installation without manually implementing * registerHook * * All you have to do is implement your hook methods * public function hookDisplayHeader(array $params) */ public function getHooks() { return array( 'displayHeader', 'displayBackOfficeHeader', ); } /** * {@inheritdoc} * * Below queries will be automatically executed on * module installation */ public function getInstallSql() { return array( 'CREATE TABLE `custom_table` ( id int, value1 varchar(255), value2 varchar(255) );', ); } /** * {@inheritdoc} * * Below queries will be automatically executed on * module uninstallation */ public function getUninstallSql() { return array( 'DROP TABLE `custom_table`', ); } /** * {@inheritdoc} * * Below tabs will be automatically added on module * installation * * Also below tabs will be automatically deleted * on module uninstall * * Keep in mind to keep the proper structure of * the array */ public function getTabs() { return array( array( // Parent tab name (or null if your tab should be parent) 'parent' => 'AdminParentOrders', // Your tab class name 'class' => 'AdminModule', // Display name of tab (will be automatically used in translation $this->l()) 'name' => 'Doing something', ), ); } /** * {@inheritdoc} * * Below media will be automatically added in * back office using displayBackOfficeHeader */ public function getBackOfficeMedia() { return array( '/modules/mycustommodule/views/js/backoffice.js', '/modules/mycustommodule/views/css/backoffice.css', ); } /** * {@inheritdoc} * * Below media will be automatically added in * front office using displayHeader */ public function getFrontOfficeMedia() { return array( '/modules/mycustommodule/views/js/frontoffice.js', '/modules/mycustommodule/views/css/frontoffice.css', ); } /** * {@inheritdoc} * * IMPORTANT NOTE: * Keep in mind to execute parent::hookDisplayHeader * and parent::hookDisplayBackOfficeHeader when your * module uses it to keep getFrontOfficeMedia() and * getBackOfficeMedia() working. * * @return void */ public function hookDisplayBackOfficeHeader() { parent::hookDisplayBackOfficeHeader(); // Your hook placeholder to keep getBackOfficeMedia() working } /** * {@inheritdoc} * * IMPORTANT NOTE: * Keep in mind to execute parent::hookDisplayHeader * and parent::hookDisplayBackOfficeHeader when your * module uses it to keep getFrontOfficeMedia() and * getBackOfficeMedia() working. * * @return void */ public function hookDisplayHeader() { parent::hookDisplayHeader(); // Your hook placeholder to keep getFrontOfficeMedia() working } }
Authors
- Presta.Expert Team
License
The files in this archive are released under the MIT LICENSE.
presta-expert/module-helper 适用场景与选型建议
presta-expert/module-helper 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 39 次下载、GitHub Stars 达 3, 最近一次更新时间为 2023 年 02 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「module」 「prestashop」 「extended」 「overwrite」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 presta-expert/module-helper 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 presta-expert/module-helper 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 presta-expert/module-helper 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Extended faker package providers
Bootstrap Wizard - Builds a wizard using a tabbalbe structure
Adds the EDTF data type to Wikibase
Extended Post Status for WordPress
PHP wrapper for PrestaShop Webservices 1.7.x and 1.6.x.
bootstrap select field module implementing http://silviomoreto.github.io/bootstrap-select/
统计信息
- 总下载量: 39
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 10
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-02-21