承接 stagem/zfc-action 相关项目开发

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

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

stagem/zfc-action

Composer 安装命令:

composer require stagem/zfc-action

包简介

ZF-Expressive auto-wiring Action

README 文档

README

Module allow use one routes pattern for all actions without re-declaration routes configuration. Either action can be accessed with next unified path /module/action. It's like to standard MVC pattern with it /controller/action.

Such as Expressive application doesn't about any controller we use for this module keyword.

Installation

Add to your composer.json repository declaration and run composer update

// composer.json

"require": {
	"stagem/zfc-action": "dev-master"
},
"repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/stagemteam/zfc-action"
    }
]

After that enable module in config/config.php

$aggregator = new ConfigAggregator([
    //...
    Stagem\Server\ConfigProvider::class,
    //...
], $cacheConfig['config_cache_path']);

and register auto-wiring route in config/routes.php

$app->injectRoutesFromConfig((new Stagem\ZfcAction\ConfigProvider())());

Notice. slim/router has problem with wildcard routes. That is why you should add to your composer.json

{
    "require": {
        "acelaya/slim-2-router": "^2.7"
    },
    "repositories": [
        {
          "type": "vcs",
          "url": "https://github.com/popovserhii/slim-2-router"
        }
    ]
}

Usage

Standalone Usage

Map your module name with namespace in src/Acme/Foo/config/module.config.php

namespace Acme\Foo;

return [
    //...
    'middleware' => [
        'foo' => __NAMESPACE__
    ],
]

Advanced Usage

Advanced usage allow use standardized and flexible approach with module naming on all application level.

Before continue reading you should install stagem/zfc-entity

Custom implementation

If you want use in third party packages you have to prepare CurrentHelper for usage. You should call next code before controller/action dispatching:

$this->currentHelper->setDefaultContext($actionOtControlletClassName);
$this->currentHelper->setResource($request->getAttribute('controller', self::DEFAULT_RESOURCE));
$this->currentHelper->setAction($request->getAttribute('action', self::DEFAULT_ACTION));
$this->currentHelper->setRequest($request);
$this->currentHelper->setRoute($route->getMatchedRoute());
$this->currentHelper->setMatchedParams($route->getMatchedParams());

统计信息

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

GitHub 信息

  • Stars: 3
  • Watchers: 3
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-05-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固