PHP code example of mikp / wn-sanctum-tokens-plugin

1. Go to this page and download the library: Download mikp/wn-sanctum-tokens-plugin 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/ */

    

mikp / wn-sanctum-tokens-plugin example snippets


// in your plugin's routes.php file

Route::group([
    'prefix' => 'api',
    'middleware' => [
        'api',
        'mikp\sanctum\Http\Middleware\UserFromBearerToken'
    ]
], function () {

    // do a thing
    Route::post('/thing', 'Author\Plugin\Http\Controllers\API@thing');
});

'mikp\sanctum\Components\CreateToken' => 'createtoken'