fire015/json-routes 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

fire015/json-routes

最新稳定版本:v1.0.0

Composer 安装命令:

composer require fire015/json-routes

包简介

Define your routes in laravel using JSON files

README 文档

README

Total Downloads Build Status

Define your routes in Laravel using JSON files.

Installation

PHP 5.4+, Laravel 4.2+, and Composer are required.

To get the latest version of JSON Routes, simply add the following line to the require block of your composer.json file:

"fire015/json-routes": "~1.0"

You'll then need to run composer install or composer update to download it and have the autoloader updated.

Once JSON Routes is installed, you need to register the service provider. Open up app/config/app.php and add the following to the providers key.

'Fire015\JsonRoutes\JsonRoutesServiceProvider'

Configuration

To get started, first publish the package config file:

$ php artisan config:publish fire015/json-routes

This will create a config file which allows you to define the path to the JSON files (by default this is a folder within app/config called routes).

Usage

Presuming we have created the app/config/routes folder as specified above, create a file in that folder called routes.json where we can define our routes. Here is an example of that file:

{
	"GET": {
		"/": {
			"uses": "HomeController@showIndex"
		},
		"about": {
			"uses": "AboutController@showIndex"
		}
	},
	"POST": {
		"user/{id}": {
			"uses": "UserController@storeUser"
		}
	}
}

You simply define the route URI as the key under each method and the usual route options as if it were an array in the Route::(get|post|put|patch|delete|options) static methods.

You can also split your routes up into sub-files and folders. For example you can define user/account in any of the following places:

  • /user.json
  • /user/routes.json
  • /user/account.json
  • /user/account/routes.json

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-12-29