承接 beanmoss/annotroute 相关项目开发

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

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

beanmoss/annotroute

Composer 安装命令:

composer require beanmoss/annotroute

包简介

Allows you to use Route annotations on your controllers.

README 文档

README

Allows you to use Route annotations on your laravel controllers.

To install annotroute as a Composer package to be used with Laravel 4, simply add this to your composer.json:

"beanmoss/annotroute": "dev-master"

..and run composer update. Once it's installed, you can register the service provider in app/config/app.php in the providers array. I strongly suggest that it should be registeristered after the Router Provider:

'providers' => array(
...
    'Beanmoss\Annotroute\AnnotrouteServiceProvider',
)

and for the Facade:

...
'AnnotRoute'      => 'Beanmoss\Annotroute\Facade\AnnotRoute',
...

#Usage

<?php
use Beanmoss\Annotroute\Annotation\Route as MyRoute;
/**
 * @MyRoute(group={"prefix" = "home", "before" = "auth"})
 */
class HomeController extends BaseController
{
    /*
      |--------------------------------------------------------------------------
      | Default Home Controller
      |--------------------------------------------------------------------------
      |
      | You may wish to use controllers instead of, or in addition to, Closure
      | based routes. That's great! Here is an example controller method to
      | get you started. To route to this controller, just add the route:
      |
      |	Route::get('/', 'HomeController@showWelcome');
      |
     */

    /**
     * @MyRoute(method="get", path="/")
     * @MyRoute(method="get", path="/welcome")
     */
    public function showWelcome()
    {
        return View::make('hello');
    }

    /**
     * @MyRoute(
     *  method="get", 
     *  path="/test/{id}/{name}", 
     *  before = "", 
     *  name="test", 
     *  where={"id" = "[0-9]+","name" = "[a-z]+"}
     * )
     */
    public function test($id, $name)
    {
        return 'test' . $id . $name;
    }
}

And somewhere in your routes.php

<?php

/*
  |--------------------------------------------------------------------------
  | Application Routes
  |--------------------------------------------------------------------------
  |
  | Here is where you can register all of the routes for an application.
  | It's a breeze. Simply tell Laravel the URIs it should respond to
  | and give it the Closure to execute when that URI is requested.
  |
 */

AnnotRoute::generateRoute('HomeController');

Thats it! If you found some bugs, please let me know. Thank you! Also, you can help me test this ;)

统计信息

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

GitHub 信息

  • Stars: 6
  • Watchers: 4
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2014-07-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固