PHP code example of diplodocker / auth-service

1. Go to this page and download the library: Download diplodocker/auth-service 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/ */

    

diplodocker / auth-service example snippets



declare(strict_types=1);

namespace App\Models;

use Diplodocker\Services\Concerns\CanUseAuthorizationTokens;
use Diplodocker\Services\Contracts\AuthorizationInterface;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable implements AuthorizationInterface
{
    // ...
    use CanUseAuthorizationTokens;

    public const TABLE_NAME = 'users';
    public const ATTR_EMAIL = 'email';

    // ...
}


declare(strict_types=1);

namespace App\Providers;

use App\Models\User;
use Illuminate\Support\ServiceProvider;
use Diplodocker\Services\Contracts\AuthorizationInterface;

class AppServiceProvider extends ServiceProvider
{
    public function boot()
    {
        $this->app->bind(
            AuthorizationInterface::class,
            User::class
        );
    }
}

php artisan jwt:secret