2.1. 安装

未匹配的标注
本文档最新版为 2.0.0,旧版本可能放弃维护,推荐阅读最新版!

Requirements & Versions

It is very important to understand which version of Dingo to use, and even more so to understand what is supported and what is not. If the version of dingo you are using is not supported, then please update it, and if necessary your version of Laravel - do NOT raise support tickets for unsupported versions!

In any case, there is very limited support for Lumen. If you are starting a new project we do not recommend you use Lumen. If you have an opportunity to move to Laravel - we recommend you do so!

Dingo Version Laravel Version Minimum PHP version Supported?
1.x.x Pre 5.6 No
2.x.x 5.6 - 6.x PHP 7.1 - 7.2 Not for long
3.x.x 7.x PHP 7.2.5 Yes

You must then modify your composer.json file and run composer update to include the latest version of the package in your project.

"require": {
    "dingo/api": "^3.0.0"
}

You may need to set your minimum-stability to dev.

Once the package is installed the next step is dependant on which framework you're using.

Laravel

If you'd like to make configuration changes in the configuration file you can publish it with the following Artisan command (otherwise, this step is not needed):

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

Lumen

Open bootstrap/app.php and register the required service provider.

$app->register(Dingo\Api\Provider\LumenServiceProvider::class);

Facades

There are two facades shipped with the package. You can add either of them should you wish.

Dingo\Api\Facade\API

This is a facade for the dispatcher, however, it also provides helper methods for other methods throughout the package.

Dingo\Api\Facade\Route

This is a facade for the API router and can be used to fetch the current route, request, check the current route name, etc.

Configuration →

本文章首发在 LearnKu.com 网站上。

上一篇 下一篇
《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
《L04 微信小程序从零到发布》
从小程序个人账户申请开始,带你一步步进行开发一个微信小程序,直到提交微信控制台上线发布。
讨论数量: 1
发起讨论 只看当前版本


Debuff
Laravel 6.x + dingo 2.4 依赖配置
5 个点赞 | 4 个回复 | 分享 | 课程版本 2.0.0