PHP code example of uccello / uccello-api

1. Go to this page and download the library: Download uccello/uccello-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

uccello / uccello-api example snippets




namespace App;

use Tymon\JWTAuth\Contracts\JWTSubject;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable implements JWTSubject
{
    use Notifiable;

    // Rest omitted for brevity

    /**
     * Get the identifier that will be stored in the subject claim of the JWT.
     *
     * @return mixed
     */
    public function getJWTIdentifier()
    {
        return $this->getKey();
    }

    /**
     * Return a key value array, containing any custom claims to be added to the JWT.
     *
     * @return array
     */
    public function getJWTCustomClaims()
    {
        return [];
    }
}

'defaults' => [
    'guard' => 'api',
    'passwords' => 'users',
],

...

'guards' => [
    'api' => [
        'driver' => 'jwt',
        'provider' => 'users',
    ],
],

// app/Http/Kernel.php

protected $middleware = [
    ...
    \Spatie\Cors\Cors::class
];

return [
    ...
    'api' => [
        'items_per_page' => 300, // Items per page
        'max_items_per_page' => 800, // Max items per page (useful if length URL param greater than max_item_per_page)
        'throws_exception' => true, // If true send an email to user with username defined below
        'username_to_notify_on_exception' => env('USERNAME_TO_NOTIFY_ON_EXCEPTION')
    ],
bash
php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\LaravelServiceProvider"
bash
php artisan jwt:secret
bash
php artisan vendor:publish --provider="Spatie\Cors\CorsServiceProvider" --tag="config"