PHP code example of mahbubur508 / api-auth

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

    

mahbubur508 / api-auth example snippets




namespace App\Models;

use Illuminate\Foundation\Auth\User as Authenticatable;
use Laravel\Sanctum\HasApiTokens;

class User extends Authenticatable
{
    use HasApiTokens;
}

return [

    /*
    |--------------------------------------------------------------------------
    | Authentication Route Prefix
    |--------------------------------------------------------------------------
    */

    'prefix' => 'api/v1/auth',

    /*
    |--------------------------------------------------------------------------
    | Sanctum Token Name
    |--------------------------------------------------------------------------
    */

    'token_name' => 'api_auth_token',

];

config/api-auth.php

'prefix' => 'api/auth',
'token_name' => 'my_custom_token',
bash
php artisan migrate
bash
php artisan vendor:publish --tag="api-auth-config"
text
config/api-auth.php