PHP code example of danilowa / laravel-api-auth

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

    

danilowa / laravel-api-auth example snippets


return [
    'route_prefix' => env('API_AUTH_ROUTE_PREFIX', 'auth'),
    'user_model' => 'App\Models\User::class',
    'default_token_name' => 'default_token',
    'revoke_all_tokens' => true,
    'messages' => [
        'user_created' => 'User created successfully!',
        'user_logged_in' => 'User logged in!',
        'credentials_incorrect' => 'The provided credentials are incorrect.',
        'tokens_revoked' => 'Tokens revoked successfully!',
        'default_error' => 'An error occurred.',
    ],
    'validation' => [
        'login' => [
            'rules' => [
                'email' => '
bash
php artisan vendor:publish --provider="Danilowa\LaravelApiAuth\Providers\ApiAuthServiceProvider"
http
POST /auth/logout
Authorization: Bearer your_jwt_token_here
http
GET /auth/user
Authorization: Bearer your_jwt_token_here