承接 tccltd/tcc-abstract-module 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tccltd/tcc-abstract-module

Composer 安装命令:

composer require tccltd/tcc-abstract-module

包简介

TccAbstractModule Package

README 文档

README

Provides an AbstractModule class that can be extended by individual Module classes to automatically implement functionality such as autoloading and configuration.

Installation

Simply add tccltd/tcc-abstract-module to your composer.json.

Usage

When creating a new module, extend TccAbstractModule\Module\AbstractModule in your Module.php.

PHP 5.3 NOTE: If you are not using PHP 5.4 then you will need to extend TccAbstractModuleNoTraits instead of TccAbstractModule. The functionality provided is identical.

For simpler modules, you may well find that this is all you need:

namespace MyModule;

use TccAbstractModule\Module\AbstractModule;

class Module extends AbstractModule
{
}

The abstract module configures the following behaviour automatically:

  1. Autoloading: The classmap defined in ./autoload_classmap.php is used in the first instance, falling back to a standard PSR-0 compatible autoloader serving files from ./src/MyModule/.

  2. Module Configuration: All files in ./config/ matching the format module.config{,.*}.php will be loaded. As a matter of good practice, you should separate your routes into module.config.routes.php.

  3. Service Configuration: Where previously you would have defined service manager invokables, services, factories, aliases, initializers and abstract_factories in the getServiceConfig() function of your Module.php, these should now be defined in ./config/service/service.config.php. The format is the same. Note that all files in ./config/service/ matching the format service.config{,.*}.php will be loaded, should you wish to further subdivide your service configuration.

  4. Controller Configuration: Where previously you would have defined controller manager invokables, services, factories, aliases, initializers and abstract_factories in the getControllerConfig() function of your Module.php, these should now be defined in ./config/service/controller.config.php. The format is the same. Note that all files in ./config/service/ matching the format controller.config{,.*}.php will be loaded, should you wish to further subdivide your controller configuration.

  5. View Helper Configuration: Where previously you would have defined view helper manager invokables, services, factories, aliases, initializers and abstract_factories in the getViewHelperConfig() function of your Module.php, these should now be defined in ./config/service/viewhelper.config.php. The format is the same. Note that all files in ./config/service/ matching the format service.config{,.*}.php will be loaded, should you wish to further subdivide your view helper configuration.

A typical file structure (focusing on the aspects related to this module) might be as follows:

module/  
  MyModule/  
    config/  
      service/  
        controller.config.php  
        service.config.php  
        viewhelper.config.php  
      module.config.php  
      module.config.routes.php  
  autoload_classmap.php  
  Module.php  

Overriding

Should you wish to modify the behaviour of the AbstractModule, you can do so by either overriding in your individual Module.php files, or you can extend the entire module and create your own AbstractModule. If you have a suggestion that might benefit all users of this module, please do feel free to suggest it, of course!

Traits

TccAbstractModule is composed of traits. This means that you can, should you wish, cherry-pick the functionality that you would like to use. In this instance you would not override AbstractModule. Instead, you would use the relevant traits within your own Module class. Note that you will need to use ClassDirTrait in order to use any of the other traits, and ClassNamespaceTrait in order to use AutoloaderProviderDefaultTrait.

It is anticipated that most users will not need to cherry-pick.

统计信息

  • 总下载量: 208
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 3
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2013-10-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固