lpcdernoncourt/annotations

Laravel 框架的路由注解。

v5.5.1 2017-11-20 18:45 UTC

README

到 Laravel 5.5

Build Status Total Downloads Latest Stable Version Latest Unstable Version License

Laravel Framework 注解的官方文档可以在 LaravelCollective 网站找到。

安装

将 Presenter 添加到你的 composer.json 文件中

"require": {
    "lpcdernoncourt/annotations": "5.5.*"
}

现在,从项目的根目录运行命令行中的 composer update

composer update

一旦 composer 完成,你需要在 app/Providers/AnnotationsServiceProvider.php 中创建一个服务提供者。

<?php namespace App\Providers;

use Collective\Annotations\AnnotationsServiceProvider as ServiceProvider;

class AnnotationsServiceProvider extends ServiceProvider {

    /**
     * The classes to scan for event annotations.
     *
     * @var array
     */
    protected $scanEvents = [];

    /**
     * The classes to scan for route annotations.
     *
     * @var array
     */
    protected $scanRoutes = [];

    /**
     * The classes to scan for model annotations.
     *
     * @var array
     */
    protected $scanModels = [];

    /**
     * Determines if we will auto-scan in the local environment.
     *
     * @var bool
     */
    protected $scanWhenLocal = false;

    /**
     * Determines whether or not to automatically scan the controllers
     * directory (App\Http\Controllers) for routes
     *
     * @var bool
     */
    protected $scanControllers = false;

    /**
     * Determines whether or not to automatically scan all namespaced
     * classes for event, route, and model annotations.
     *
     * @var bool
     */
    protected $scanEverything = false;

}

注册包

app/config/app.php 中包含服务提供者。服务提供者对于生成 artisan 命令是必需的。

'providers' => [
    // ...
    App\Providers\AnnotationsServiceProvider::class
    // ...
  ];