Installation in Lumen

NOTE: Lumen is not officially supported by this package. However, the following are some steps which may help get you started.

First, install the package via Composer:

composer require spatie/laravel-permission

Copy the required files:

mkdir -p config
cp vendor/spatie/laravel-permission/config/permission.php config/permission.php
cp vendor/spatie/laravel-permission/database/migrations/create_permission_tables.php.stub database/migrations/2018_01_01_000000_create_permission_tables.php

You will also need to create another configuration file at config/auth.php. Get it on the Laravel repository or just run the following command:

curl -Ls -o config/auth.php

Then, in bootstrap/app.php, register the middlewares:

    'auth'       => App\Http\Middleware\Authenticate::class,
    'permission' => Spatie\Permission\Middlewares\PermissionMiddleware::class,
    'role'       => Spatie\Permission\Middlewares\RoleMiddleware::class,

Also register the config file, service provider, and cache alias:

$app->alias('cache', \Illuminate\Cache\CacheManager::class);  // if you don't have this already

Now, run your migrations:

php artisan migrate