PHP code example of kiwilan / sentinel-laravel

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

    

kiwilan / sentinel-laravel example snippets


return [
    /**
     * If you want to disable Sentinel, set `SENTINEL_ENABLED` to `false`.
     */
    'enabled' => env('SENTINEL_ENABLED', true),
    /**
     * Sentinel host where your application is registered.
     */
    'host' => env('SENTINEL_HOST', 'http://app.sentinel.test'),
    /**
     * Token is used to authenticate your application with Sentinel.
     */
    'token' => env('SENTINEL_TOKEN'),
    /**
     * If you want to throw Sentinel errors for debug, set `SENTINEL_DEBUG` to `true`.
     * WARNING: do not use it on production.
     */
    'debug' => env('SENTINEL_DEBUG', false),
];




namespace App\Exceptions;

use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;

class Handler extends ExceptionHandler
{
  /**
   * Register the exception handling callbacks for the application.
   */
  public function register(): void
  {
    $this->reportable(function (Throwable $e) {
      \Kiwilan\Sentinel\Facades\Sentinel::register($e);
    });
  }
}

Route::get('/debug-sentinel', function () {
  throw new \Exception('Sentinel error!');
});
bash
php artisan vendor:publish --tag="sentinel-config"
bash
php artisan sentinel:install
bash
php artisan sentinel:test