<commit_before>---
title: Installation in Laravel
weight: 4
---

This package can be used in Laravel 5.8 or higher.

1. Consult the Prerequisites page for important considerations regarding your User models!

2. You can install the package via composer:

        composer require spatie/laravel-permission

3. Optional: The service provider will automatically get registered. Or you may manually add the service provider in your `config/app.php` file:

    ```php
    'providers' => [
        // ...
        Spatie\Permission\PermissionServiceProvider::class,
    ];
    ```
4. You should publish [the migration](https://github.com/spatie/laravel-permission/blob/master/database/migrations/create_permission_tables.php.stub) and the [`config/permission.php` config file](https://github.com/spatie/laravel-permission/blob/master/config/permission.php) with:

    ```bash
    php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider"
    ```

5. NOTE: If you are using UUIDs, see the Advanced section of the docs on UUID steps, before you continue. It explains some changes you may want to make to the migrations and config file before continuing. It also mentions important considerations after extending this package's models for UUID capability.

6. Run the migrations: After the config and migration have been published and configured, you can create the tables for this package by running:

        php artisan migrate

7. Add the necessary trait to your User model.

   Consult the Basic Usage section of the docs for how to get started using the features of this package.


### Default config file contents

You can view the default config file contents at: 
https://github.com/spatie/laravel-permission/blob/master/config/permission.php<commit_msg>Update installation-laravel.md<commit_after>---
title: Installation in Laravel
weight: 4
---

This package can be used with Laravel 5.8 or higher.

1. Consult the Prerequisites page for important considerations regarding your User models!

2. You can install the package via composer:

        composer require spatie/laravel-permission

3. Optional: The service provider will automatically get registered. Or you may manually add the service provider in your `config/app.php` file:

    ```php
    'providers' => [
        // ...
        Spatie\Permission\PermissionServiceProvider::class,
    ];
    ```

4. You should publish [the migration](https://github.com/spatie/laravel-permission/blob/master/database/migrations/create_permission_tables.php.stub) and the [`config/permission.php` config file](https://github.com/spatie/laravel-permission/blob/master/config/permission.php) with:

    ```bash
    php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider"
    ```

5. NOTE: If you are using UUIDs, see the Advanced section of the docs on UUID steps, before you continue. It explains some changes you may want to make to the migrations and config file before continuing. It also mentions important considerations after extending this package's models for UUID capability.

6. Run the migrations: After the config and migration have been published and configured, you can create the tables for this package by running:

        php artisan migrate

7. Add the necessary trait to your User model.

   Consult the Basic Usage section of the docs for how to get started using the features of this package.


### Default config file contents

You can view the default config file contents at: 
https://github.com/spatie/laravel-permission/blob/master/config/permission.php
{'fraction_non_alphanumeric': 0.07597765363128492, 'fraction_numerical': 0.00558659217877095, 'mean_word_length': 3.9393103448275864, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1334183', 'n_tokens_mistral': 920, 'n_tokens_neox': 893, 'n_words': 400}