Installation &amp; setup | laravel-error-solutions | Spatie

 SPATIE

  Laravel Error Solutions
==========================

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Laravel-error-solutions](https://spatie.be/docs/laravel-error-solutions/v1)  Installation &amp; setup

 Version   v1

 Other versions for crawler [v1](https://spatie.be/docs/laravel-error-solutions/v1)

- [ Introduction ](https://spatie.be/docs/laravel-error-solutions/v1/introduction)
- [ Support us ](https://spatie.be/docs/laravel-error-solutions/v1/support-us)
- [ Requirements ](https://spatie.be/docs/laravel-error-solutions/v1/requirements)
- [ Installation &amp; setup ](https://spatie.be/docs/laravel-error-solutions/v1/installation-setup)
- [ Questions and issues ](https://spatie.be/docs/laravel-error-solutions/v1/questions-issues)
- [ Changelog ](https://spatie.be/docs/laravel-error-solutions/v1/changelog)
- [ About us ](https://spatie.be/docs/laravel-error-solutions/v1/about-us)

Basic usage
-----------

- [ Displaying solutions ](https://spatie.be/docs/laravel-error-solutions/v1/basic-usage/displaying-solutions)
- [ Runnable solutions ](https://spatie.be/docs/laravel-error-solutions/v1/basic-usage/runnable-solutions)
- [ AI powered solutions ](https://spatie.be/docs/laravel-error-solutions/v1/basic-usage/ai-powered-solutions)

Creating your own solutions
---------------------------

- [ Introduction ](https://spatie.be/docs/laravel-error-solutions/v1/creating-your-own-solutions/introduction)
- [ Creating a solution class ](https://spatie.be/docs/laravel-error-solutions/v1/creating-your-own-solutions/creating-a-solution-class)
- [ On exceptions ](https://spatie.be/docs/laravel-error-solutions/v1/creating-your-own-solutions/on-exceptions)
- [ Via a solution provider ](https://spatie.be/docs/laravel-error-solutions/v1/creating-your-own-solutions/via-a-solution-provider)

 Installation &amp; setup
========================

###  On this page

1. [ Publishing the config file ](#content-publishing-the-config-file)
2. [ Publishing the views files ](#content-publishing-the-views-files)

You can install the package via composer:

```
composer require spatie/laravel-error-solutions
```

Publishing the config file
--------------------------------------------------------------------------------------------------------------------------------------

Optionally, you can publish the `error-solutions` config file with this command.

```
php artisan vendor:publish --tag="error-solutions-config"
```

This is the content of the published config file:

```
return [
    /**
     * Display solutions on the error page
     */
    'enabled' => true,

    /*
     * Enable or disable runnable solutions.
     *
     * Runnable solutions will only work in local development environments,
     * even if this flag is set to true.
     */
    'enable_runnable_solutions' => true,

    /*
     * The solution providers that should be used to generate solutions.
     *
     * First we load the default PHP and Laravel defaults provided by
     * the base error solution package, then we load the ones you provide here.
     */
    'solution_providers' => [
        'php',
        'laravel',
        // your solution provider classes
    ],

    /*
     * When a key is set, we'll send your exceptions to Open AI to generate a solution
     */
    'open_ai_key' => env('ERROR_SOLUTIONS_OPEN_AI_KEY'),

    /*
     * This class is responsible for determining if a solution is runnable.
     *
     * In most cases, you can use the default implementation.
     */
    'runnable_solutions_guard' => Spatie\LaravelErrorSolutions\Support\RunnableSolutionsGuard::class,
];
```

Publishing the views files
--------------------------------------------------------------------------------------------------------------------------------------

Optionally, you can publish the views using

```
php artisan vendor:publish --tag="error-solutions-views"
```
