定制 ollie-troward/slim-controller 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

ollie-troward/slim-controller

最新稳定版本:0.1

Composer 安装命令:

composer require ollie-troward/slim-controller

包简介

Controller extension for Slim

README 文档

README

A controller extension for the Slim Framework V2.

About

A quick way to define your controller routes and functions. Placing them in classes opposed to anonymous functions using a lightweight extensible class for your controllers.

Usage

# Instantiate your Slim application.
$app = new \Slim\Slim();

# If you're using a namespace, include it here.
$config = [
    'namespace' => 'My\\Controller\\Namespace'
];

# Include the SlimController class in your bootstrap file.
$controller = new \Troward\SlimController\SlimController($app, $config);

# Define your routes, you can use GET, POST, PUT and DELETE.
$routes = [
    'GET' => [
        # You need to define the URI as the key and the Controller@method as the value.
        '/' => 'ControllerClassName@controllerMethod',
        
        # Some examples are below
        'hello' => 'HelloController@index',
        'hello/:id' => 'HelloController@show'
    ]
];

# Register your routes in the SlimController.
$controller->routes($routes);

# Run your application.
$app->run();

Licence

The Slim Controller is open-sourced software licensed under the MIT Licence.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-11-07