大家好,又见面了,我是你们的朋友全栈君。
composer.json
增加两句:
"minimum-stability" : "dev"
—— 设定的最低稳定性的版本为 dev 也就是可以依赖开发版本的扩展包;"prefer-stable" : true
—— Composer 优先使用更稳定的包版本。执行命令安装:
D:\WWW\>composer require dingo/api
Using version ^2.2 for dingo/api
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 4 installs, 0 updates, 0 removals
- Installing league/fractal (0.17.0): Loading from cache
- Installing doctrine/annotations (v1.6.1): Loading from cache
- Installing dingo/blueprint (dev-master 76b1621): Cloning 76b1
- Installing dingo/api (v2.2.3): Loading from cache
league/fractal suggests installing pagerfanta/pagerfanta (Pagerfa
league/fractal suggests installing zendframework/zend-paginator (
dingo/api suggests installing tymon/jwt-auth (Protect your API wi
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Discovered Package: [32mbeyondcode/laravel-dump-server[39m
Discovered Package: [32mdingo/api[39m
Discovered Package: [32mfideloper/proxy[39m
Discovered Package: [32mlaravel/nexmo-notification-channel[39m
Discovered Package: [32mlaravel/slack-notification-channel[39m
Discovered Package: [32mlaravel/tinker[39m
Discovered Package: [32mnesbot/carbon[39m
Discovered Package: [32mnunomaduro/collision[39m
[32mPackage manifest generated successfully.[39m
dingo/api 已经成功安装了。
先将 dingo 的配置文件 publish 出来
php artisan vendor:publish
执行成功后,我们会在 config 目录先看到 api.php 文件,打开文件我们可以看到所有的配置都是可以再 env 中修改的,下面我们主要讲解一下我们需要用到的配置 详解:
.env 文件
API_STANDARDS_TREE=prs
API_SUBTYPE=api
API_PREFIX=api
API_VERSION=v1
API_DEBUG=flase
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/105855.html原文链接:https://javaforall.cn