bulton-fr/bfw-controller
Composer 安装命令:
composer require bulton-fr/bfw-controller
包简介
Controllers module for BFW
关键字:
README 文档
README
Module Controller pour BFW
Install :
You can use composer to get the module : composer require bulton-fr/bfw-controller @stable
And to install the module : ./vendor/bin/bfwInstallModules
Config :
All config file for this module will be into app/config/bfw-controller/. There are one file to configure (manifest.json is for the module update system).
The file config.php
useClass: Define if all controller will be classes (true) or procedural file (false).
Use it :
Create your controller files into the directory /src/controllers.
For an object controller, you can extends from the class \BfwController\Controller. This class adding properties $app and $request who are a direct access to the instance of the classes \BFW\Application and \BFW\Request. You can use the namespace \Controller, it's added by the framework and corresponding to the directory /src/controllers.
For a procedural controller, the file will be included into a closure who is into the method \BfwController\BfwController::runProcedural(). So you will have a direct access to $this of the class, and you will have variables $routerLinker and $controllerFile into the scope.
Example :
Extract from the BFW wiki, an exemple with an object controller.
<?php namespace Controller; class Test extends \BfwController\Controller { public function index() { var_dump($this->request->getRequest()); } }
Router module :
This module not manage the application routing. You need to add a router module too.
The route module have a config file to define each route. For each route, you should define a "target". With bfw-controller, the "target" value should have a specified format :
- For an object controller : An array, the first value should be the class name (with namespace), the second value the method name. Like a callable array.
- For a procedural controller : The filename with this extension. The path to the directory /src/controller should be omitted.
统计信息
- 总下载量: 507
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 1
其他信息
- 授权协议: LGPL-3.0
- 更新时间: 2014-03-07