Flare Error tracking made for Laravel
Features Pricing Docs Blog Log in Start free trial Free trial
  • Docs
  • Videos

Documentation

  • General

    • Welcome
    • Projects
    • Errors
    • Error occurrences
    • Using the API
    • Sharing error occurrences
    • Spike protection
    • GitHub integration
  • Ignition for Laravel

    • Installation
    • Configuration
    • Security
    • Controlling collected data
    • Sending logs to Flare
    • Linking to errors
    • Identifying users
    • Adding custom context
    • Adding glows
    • Writing custom middleware
  • Flare for generic PHP projects

    • Installation
    • Controlling collected data
    • Identifying users
    • Linking to errors
    • Adding custom context
    • Adding glows
    • Writing custom middleware
  • Javascript error tracking

    • Installation
    • Framework integrations
    • Resolving Bundled Code
    • Reporting errors
    • Client hooks
    • Adding custom context
    • Adding glows
    • Solution Providers
  • Solutions

    • Introduction
    • Adding custom solutions
    • Making solutions runnable
    • Using solution providers
    • Writing good solutions
  • Notifications

    • Configuring notifications
    • Mail
    • Slack
    • Telegram
    • SMS
    • Webhooks
    • Discord
    • Microsoft Teams
  • Team management

    • Using multiple teams
    • Subscribing to a plan
    • Receiving invoices
    • Managing team members
    • Inviting guests to projects

Making solutions runnable

Ignition can also help and run custom solutions to try and automatically fix an error. Here's how a runnable solution looks like.

Screenshot of error with runnable solution

To mark your solution as "runnable", let it implement the Facade\IgnitionContracts\RunnableSolution interface. Here is how that interface looks like:

namespace Facade\IgnitionContracts;

interface RunnableSolution extends Solution
{
    public function getSolutionActionDescription(): string;

    public function getRunButtonText(): string;

    public function run(array $parameters = []);

    public function getRunParameters(): array;
}

To return that solution in one of your exceptions, let your exception implement the Facade\IgnitionContracts\ProvidesSolution interface.

class MyException extends Exception implements ProvidesSolutions
{
    public function getSolutions(): array
    {
        return [new MyRunnableSolution()];    
    }
}

And this is an example of a runnable solution class.

namespace App\Solutions;

use Facade\IgnitionContracts\RunnableSolution;

class MyRunnableSolution implements RunnableSolution
{
    public function getSolutionTitle(): string
        {
            return 'My solution title';
        }
    
        public function getSolutionDescription(): string
        {
            return 'My solution description';
        }
    
        public function getDocumentationLinks(): array
        {
            return [
                'My docs' => 'https://flareapp.io/docs',
            ];
        }
    
        public function getSolutionActionDescription(): string
        {
            return 'We can try to solve this exception by running a little code';
        }
    
        public function getRunButtonText(): string
        {
            return 'Press me to run the solution';
        }
    
        public function run(array $parameters = [])
        {
            // code that tries to fix the problem
        }
    
        /*
         *  The array you return here will be passed to the `run` function.
         *
         *  Make sure everything you return here is serializable.
         *
         */
        public function getRunParameters(): array
        {   
            return [];
        }
}
Previous topic Next topic

About Flare

  • Home
  • Features
  • Pricing
  • Support

Resources

  • Blog
  • Changelog
  • Docs
  • Ignition

App

  • Log in
  • Start free trial
SPATIE
  • Service status
  • Terms of use
  • Privacy & cookie policy