Skip to content

Installation

Max edited this page Apr 30, 2021 · 21 revisions

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 No
3.x.x 7.x - 8.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 →