Download the PHP package uccello/uccello-api without Composer
On this page you can find all versions of the php package uccello/uccello-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package uccello-api
Install package
Config JWT
Publish the config
Run the following command to publish the package config file:
You should now have a config/jwt.php file that allows you to configure the basics of this package.
Generate secret key
I have included a helper command to generate a key for you:
This will update your .env file with something like JWT_SECRET=foobar
It is the key that will be used to sign your tokens. How that happens exactly will depend on the algorithm that you choose to use.
Update your User model
Firstly you need to implement the Tymon\JWTAuth\Contracts\JWTSubject contract on your User model, which requires that you implement the 2 methods getJWTIdentifier() and getJWTCustomClaims().
The example below should give you an idea of how this could look. Obviously you should make any changes, as necessary, to suit your own needs.
Configure Auth guard
Note: This will only work if you are using Laravel 5.2 and above.
Inside the config/auth.php file you will need to make a few changes to configure Laravel to use the jwt guard to power your application authentication.
Make the following changes to the file:
Here we are telling the api guard to use the jwt driver, and we are setting the api guard as the default.
We can now use Laravel's built in Auth system, with jwt-auth doing the work behind the scenes!
Config CORS
The provided Spatie\Cors\Cors middleware must be registered in the global middleware group.
Config
You can add this parameters to config/uccello.php
:
Daily usage
You can pass several params to the request URL:
Param | Description | Default | Example |
---|---|---|---|
descendants | Activate (1) or not (0) descendant view according to the user's roles. | 0 | &descendants=1 |
select | Semicolon separated list of columns to retrieve. | &select=name;created_at | |
order | Semicolon and comma separated list of the order clauses. | &order=name,asc;email,desc | |
with | Semicolon separated list of the relations to add in the response. | &with=domain;clients | |
length | Pagination length. | 100 | &length=300 |
All versions of uccello-api with dependencies
uccello/uccello Version 2.*
darkaonline/l5-swagger Version ^8.0