承接 flaviojr/silex-controller-provider 相关项目开发

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

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

flaviojr/silex-controller-provider

Composer 安装命令:

composer require flaviojr/silex-controller-provider

包简介

Controller provider for silex applications

README 文档

README

Controller provider for silex

What is this?

This provider contains the logic to load your controllers dynamically, registering them in you Silex Applications. With this, you no longer needs to manually register each one of your controllers, passing their respective dependencies.

Usage

To install it:

$ composer require "flaviojr/silex-controller-provider":"1.0"

To use this provider, you simply need to register it within your application:

//Don't forget to register this provider first
$app->register(new Silex\Provider\ServiceControllerServiceProvider);

$app->register(new Sneek\Providers\ControllerProvider('controller-dir', 'Your-root-namespace'[, 'your-namespace-mirror']));
  • The first parameter indicate where your controller files are.
  • The second one is the root namespace from where your controllers are. For example, if your controller namespace is App\Controllers\HomeController, then the value to be passed is the string 'App'.
  • The last parameter is optional, you should use it if your root namespace isn't the name of your root directory. For example, if you have a folder structure like this: src/Controllers/CoffeeController, having the namespace App\Controllers\CoffeeController you have to pass the 'src' string, so that the provider know that 'src' is equivalent to 'App' in this case.

Using the registered controllers

The provider register your controllers using their namespaces as index. To access they in your routes, you just need to pass their namespace followed by the method you are trying to access.

$app->get('/', 'App\Controllers\CoffeeController:index');

Notes

  • You don't have to worry about your controller dependencies, the provider will recursively resolve each one of them.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-07-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固