recherche

Maison  >  Questions et réponses  >  le corps du texte

installation et configuration de laravel dingo/api

Après avoir installé Laravel,

Commencez à installer Laravel Dingo/api

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

Suivez les conseils ci-dessus

composer require dingo/api:0.10.*

C'est directement un rapport d'erreur,

Plus tard, je l'ai simplement changé en

composer require dingo/api

Ouvert config/app.php

Puis dans providers 配置里面 加上 DingoApiProviderLaravelServiceProvider::class

Comme suit :

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

Écrivez sur config/api.php

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

Il y a maintenant un fichier api.php dans le dossier de configuration

Fichier de configuration .env

Dans le dossier .env, ajoutez ce qui suit

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

À ce stade, je ne sais pas quoi faire ensuite

Ce qui suit est le document, je ne comprends pas ce que cela signifie

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;
});

Maintenant que nous avons atteint cette étape, que devons-nous faire ? , continuez quoi faire

Y a-t-il une petite démo de dingo/api pour laravel5.1

Je ne comprends pas le document

大家讲道理大家讲道理2864 Il y a quelques jours761

répondre à tous(4)je répondrai

  • 大家讲道理

    大家讲道理2017-05-16 16:57:47

    C'est lié à Laravel, jetez-y d'abord, n'oubliez pas de le vérifier ce soir

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

    Il semble que le document officiel soit très clair :

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

    ==============Mettre à jour à nouveau================

    La vidéo de la série Laravel 5 RESTful API a été enregistrée, vous pouvez la regarder si vous êtes intéressé

    https://laravist.com/series/pe-into-restful-api-with-laravel

    répondre
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-16 16:57:47

    $app['DingoApiHttpRateLimitHandler']->extend(function ($app) {
    renvoyer le nouveau DingoApiHttpRateLimitThrottleAuthenticated ;
    });

    Excusez-moi, à quel fichier cela doit-il être ajouté ?

    répondre
    0
  • 阿神

    阿神2017-05-16 16:57:47

    dingo fournit une méthode de vérification de base, bien sûr, elle peut également être étendue pour utiliser la méthode JWT ou OAuth
    Vous pouvez d'abord ignorer la partie authentification, essayer de créer des routes API selon le wiki, puis revenir déboguer la partie vérification lorsque vous avez presque terminé

    répondre
    0
  • 黄舟

    黄舟2017-05-16 16:57:47

    Voici une démo
    https://github.com/huanghua581/dingo-api-demo

    répondre
    0
  • Annulerrépondre