-
Notifications
You must be signed in to change notification settings - Fork 59
Installation
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? |
---|---|---|---|
4.x.x | 10.x - 11.x | PHP 8.1 | Yes |
4.x.x | 9.x | PHP 8.1 | No |
3.x.x | 7.x - 8.x | PHP 7.2.5 | No |
2.x.x | 5.6 - 6.x | PHP 7.1 - 7.2 | No |
1.x.x | Pre 5.6 | No |
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": "^4.0"
}
You may need to set your
minimum-stability
todev
.
Once the package is installed the next step is dependant on which framework you're using.
Optionally, if you are using the blueprint package for api doc generation (this is considered legacy and is not supported), you can add that dependency to your composer.json
file also.
"require": {
"dingo/blueprint": "~0.4"
}
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"
Open bootstrap/app.php
and register the required service provider.
$app->register(Dingo\Api\Provider\LumenServiceProvider::class);
There are two facades shipped with the package. You can add either of them should you wish.
This is a facade for the dispatcher, however, it also provides helper methods for other methods throughout the package.
This is a facade for the API router and can be used to fetch the current route, request, check the current route name, etc.