laravel dingo/api 安装与配置


安装好 laravel 后 ,

开始 安装 laravel dingo/api


 https://github.com/dingo/api/wiki/Installation

按照 上面的 提示


 composer require dingo/api:0.10.*

是直接报错了,

后来 干脆改成了


 composer require dingo/api

打开 config/app.php

接着在 providers 配置里面 加上 Dingo\Api\Provider\LaravelServiceProvider::class

如下:


 'providers' => [
    Dingo\Api\Provider\LaravelServiceProvider::class
]

写入 config/api.php


 php artisan vendor:publish --provider="Dingo\Api\Provider\LaravelServiceProvider"

这是后就在 config文件夹下 多出了 一个 api.php 文件

配置 .env 文件

在.env 文件夹下 增加如下


 API_PREFIX=api    
API_CONDITIONAL_REQUEST=false
API_STRICT=false
API_DEFAULT_FORMAT=json

到此 后面就不知道该怎么做了

下面是 文档,不理解是什么意思了


 Authentication Providers

By default only basic authentication is enabled. Authentication is covered in more detail in a later chapter.

You must configure this in a published configuration file or in your bootstrap file.

$app['Dingo\Api\Auth\Auth']->extend('oauth', function ($app) {
   return new Dingo\Api\Auth\Provider\JWT($app['Tymon\JWTAuth\JWTAuth']);
});
Throttling / Rate Limiting

By default rate limiting is disabled. You can register your custom throttles with the rate limiter or use the existing authenticated and unauthenticated throttles.

You must configure this in a published configuration file or in your bootstrap file.

$app['Dingo\Api\Http\RateLimit\Handler']->extend(function ($app) {
    return new Dingo\Api\Http\RateLimit\Throttle\Authenticated;
});

到 这一步了 该怎么做呢 。,继续 该怎么做呢

有没有 laravel5.1 的 dingo/api 小demo呢

文档有些看不懂呀

laravel api laravel5.1

种田东山上 9 years, 8 months ago

laravel有关,先占个坑,晚上记得再看看

======================

貌似官方文档实在很清晰:

https://github.com/dingo/api/wiki/Creating-API-Endpoints

GAL中毒已深 answered 9 years, 8 months ago

Your Answer