承接 chobo1210/yaml-route 相关项目开发

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

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

chobo1210/yaml-route

Composer 安装命令:

composer require chobo1210/yaml-route

包简介

implements Routing using yaml file for CakePHP 3

README 文档

README

implements Yaml Routing which allows you to write routes using yaml language instead of php

Requirements

The 3.0 branch has the following requirements:

  • CakePHP 3.0.0 or greater.

Installation

  • Install the plugin with composer from your CakePHP Project's ROOT directory (where composer.json file is located)
php composer.phar require chobo1210/yaml-route "dev-master"

OR

add this lines to your composer.json

"require": {
  "chobo1210/yaml-route": "dev-master"
}

And run php composer.phar update

then add this lines to your config/bootstrap.php

Plugin::load('YamlRoute', ['routes' => true]);

then create your routes file config/routes.yml

##Example

Routes:
    scope: /
    index:
        path: /
        controller: Pages
        action: display
        arg: home
    pages:
        path: /pages/*
        controller: Pages
        action: display
    voyage:
        path: /blog/:slug-:id
        controller: Posts
        action: view
        args:
            _name: view_single_post
            pass:
                - id
                - slug
            id: '[0-9]+'

gives this

Router::scope('/', function($routes) {

	$routes->connect('/', ['controller' => 'Pages', 'action' => 'display', 'home']);

	$routes->connect('/pages/*', ['controller' => 'Pages', 'action' => 'display']);

	$routes->connect('/blog/:slug-:id', 
	    ['controller' => 'Posts', 'action' => 'view'],
	    ['_name' => 'view_single_post', 'pass' => ['id', 'slug'], 'id' => '[0-9]+']);

	$routes->fallbacks();
});

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2014-10-27