1. Go to this page and download the library: Download ryangjchandler/bearer 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/ */
ryangjchandler / bearer example snippets
use RyanChandler\Bearer\Models\Token;
$token = Token::create([
'token' => Str::random(32),
]);
use RyanChandler\Bearer\Facades\Bearer;
$token = Bearer::generate(domains: [], expiresAt: null);
use RyanChandler\Bearer\Facades\Bearer;
Bearer::generateTokenUsing(static function (): string {
return (string) Str::orderedUuid();
});
use RyanChandler\Bearer\Facades\Bearer;
$token = Bearer::find('my-token-string');
use RyanChandler\Bearer\Http\Middleware\VerifyBearerToken;
Route::get('/endpoint', MyEndpointController::class)->middleware(VerifyBearerToken::class);