├── Dockerfile ├── src ├── IgnitionBundle.php ├── Resources │ └── config │ │ └── services.xml ├── Service │ └── IgnitionErrorListener.php └── DependencyInjection │ ├── Configuration.php │ └── IgnitionExtension.php ├── docker-compose.yaml ├── LICENSE.md ├── composer.json ├── CHANGELOG.md └── README.md /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.2 2 | WORKDIR /var/task 3 | RUN apt-get update -y && apt-get install -y git zip unzip 4 | COPY --from=composer:2 /usr/bin/composer /usr/local/bin/composer 5 | -------------------------------------------------------------------------------- /src/IgnitionBundle.php: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 13 | 14 | 15 | 16 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) spatie 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/Service/IgnitionErrorListener.php: -------------------------------------------------------------------------------- 1 | [ 25 | ['onKernelException', -127], // The default error listener is -128 26 | ], 27 | ]; 28 | } 29 | 30 | public function onKernelException(ExceptionEvent $event) 31 | { 32 | $error = $event->getThrowable(); 33 | 34 | // Get the output from Ignition 35 | ob_start(); 36 | $this->ignition->handleException($error); 37 | $output = ob_get_clean(); 38 | 39 | // Return Ignition's output as a Symfony response 40 | $response = new Response($output); 41 | $event->setResponse($response); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/DependencyInjection/Configuration.php: -------------------------------------------------------------------------------- 1 | getRootNode(); 14 | $rootNode 15 | ->children() 16 | ->scalarNode('application_path') 17 | ->defaultValue('') 18 | ->info('When setting the application path, Ignition will trim the given value from all paths. This will make the error page look cleaner.') 19 | ->end() 20 | ->booleanNode('dark_mode') 21 | ->defaultFalse() 22 | ->info('By default, Ignition uses a nice white based theme. If this is too bright for your eyes, you can use dark mode.') 23 | ->end() 24 | ->booleanNode('should_display_exception') 25 | ->defaultValue('%kernel.debug%') 26 | ->info('Avoid rendering Ignition, for example in production environments.') 27 | ->end() 28 | ->scalarNode('openai_key') 29 | ->defaultValue('') 30 | ->info('if you want AI solutions to your app\'s errors.') 31 | ->end() 32 | ->end(); 33 | 34 | return $treeBuilder; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/DependencyInjection/IgnitionExtension.php: -------------------------------------------------------------------------------- 1 | load('services.xml'); 17 | 18 | $config = $this->processConfiguration( 19 | $this->getConfiguration($configs, $container), 20 | $configs 21 | ); 22 | 23 | $definition = $container->getDefinition('spatie_ignition.ignition'); 24 | 25 | if (true == $config['dark_mode']) { 26 | $definition->addMethodCall('useDarkMode'); 27 | } 28 | 29 | $definition->addMethodCall('applicationPath', [$config['application_path']]); 30 | $definition->addMethodCall('shouldDisplayException', [$config['should_display_exception']]); 31 | 32 | $openAiKey = $config['openai_key'] ?? null; 33 | if ($openAiKey !== null && $openAiKey !== "") { 34 | $aiSolutionProvider = new OpenAiSolutionProvider($openAiKey); 35 | $aiSolutionProvider->applicationType('Symfony'); 36 | $definition->addMethodCall('addSolutionProviders', [$aiSolutionProvider]); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "spatie/symfony-ignition-bundle", 3 | "type": "symfony-bundle", 4 | "description": "A beautiful error page for Symfony apps", 5 | "keywords": [ 6 | "spatie", 7 | "symfony-ignition-bundle" 8 | ], 9 | "homepage": "https://github.com/spatie/symfony-ignition-bundle", 10 | "license": "MIT", 11 | "authors": [ 12 | { 13 | "name": "Andrew MacRobert", 14 | "email": "andrew.macrobert@gmail.com", 15 | "role": "Developer" 16 | }, 17 | { 18 | "name": "Freek Van der Herten", 19 | "email": "freek@spatie.be", 20 | "role": "Developer" 21 | } 22 | ], 23 | "require": { 24 | "php": "^8.1", 25 | "spatie/ignition": "^1.0", 26 | "symfony/dependency-injection": "^5.4|^6.3|^7.0|^8.0", 27 | "symfony/config": "^5.4|^6.0|^7.0|^8.0", 28 | "symfony/http-kernel": "^5.4|^6.0|^7.0|^8.0", 29 | "symfony/event-dispatcher": "^5.4|^6.0|^7.0|^8.0", 30 | "symfony/http-foundation": "^5.4|^6.0|^7.0|^8.0" 31 | }, 32 | "require-dev": { 33 | "phpunit/phpunit": "^9.5", 34 | "symfony/filesystem": "^5.4|^6.0|^7.0|^8.0", 35 | "symfony/process": "^5.4|^6.0|^7.0|^8.0", 36 | "symfony/dom-crawler": "^5.4|^6.0|^7.0|^8.0" 37 | }, 38 | "autoload": { 39 | "psr-4": { 40 | "Spatie\\SymfonyIgnitionBundle\\": "src" 41 | } 42 | }, 43 | "autoload-dev": { 44 | "psr-4": { 45 | "Spatie\\SymfonyIgnitionBundle\\Tests\\": "tests" 46 | } 47 | }, 48 | "scripts": { 49 | "test": "vendor/bin/phpunit", 50 | "format": "vendor/bin/php-cs-fixer fix --allow-risky=yes" 51 | }, 52 | "config": { 53 | "sort-packages": true, 54 | "allow-plugins": { 55 | "pestphp/pest-plugin": true 56 | } 57 | }, 58 | "minimum-stability": "stable", 59 | "prefer-stable": true 60 | } 61 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to `symfony-ignition-bundle` will be documented in this file. 4 | 5 | ## 1.2.0 - 2025-01-08 6 | 7 | ### What's Changed 8 | 9 | #### Features 10 | 11 | * Add openai_key as an option to the Symfony config by @mrunkel in https://github.com/spatie/symfony-ignition-bundle/pull/31 12 | 13 | #### Documentations 14 | 15 | * Fix configuration example at README.md by @diimpp in https://github.com/spatie/symfony-ignition-bundle/pull/29 16 | 17 | #### Security 18 | 19 | * Bump dependabot/fetch-metadata from 1.6.0 to 2.1.0 by @dependabot in https://github.com/spatie/symfony-ignition-bundle/pull/27 20 | * Bump dependabot/fetch-metadata from 2.1.0 to 2.2.0 by @dependabot in https://github.com/spatie/symfony-ignition-bundle/pull/28 21 | 22 | ### New Contributors 23 | 24 | * @diimpp made their first contribution in https://github.com/spatie/symfony-ignition-bundle/pull/29 25 | * @mrunkel made their first contribution in https://github.com/spatie/symfony-ignition-bundle/pull/31 26 | 27 | **Full Changelog**: https://github.com/spatie/symfony-ignition-bundle/compare/1.1.0...1.2.0 28 | 29 | ## 1.1.0 - 2023-12-16 30 | 31 | Add support for: 32 | 33 | - Symfony 7.0 34 | - PHP 8.2 35 | - PHP 8.3 36 | 37 | Drop support for: 38 | 39 | - PHP 8.0 40 | - Symfony 6.0 41 | - Symfony 6.2 42 | 43 | ## 0.0.3 - 2023-06-22 44 | 45 | ### What's Changed 46 | 47 | - Bump dependabot/fetch-metadata from 1.2.1 to 1.3.0 by @dependabot in https://github.com/spatie/symfony-ignition-bundle/pull/9 48 | - Bump dependabot/fetch-metadata from 1.3.0 to 1.3.1 by @dependabot in https://github.com/spatie/symfony-ignition-bundle/pull/10 49 | - Bump actions/checkout from 2 to 3 by @dependabot in https://github.com/spatie/symfony-ignition-bundle/pull/8 50 | - Bump dependabot/fetch-metadata from 1.3.1 to 1.3.3 by @dependabot in https://github.com/spatie/symfony-ignition-bundle/pull/12 51 | - Bump dependabot/fetch-metadata from 1.3.3 to 1.3.4 by @dependabot in https://github.com/spatie/symfony-ignition-bundle/pull/13 52 | - Bump dependabot/fetch-metadata from 1.3.4 to 1.3.5 by @dependabot in https://github.com/spatie/symfony-ignition-bundle/pull/14 53 | - Bump dependabot/fetch-metadata from 1.3.5 to 1.3.6 by @dependabot in https://github.com/spatie/symfony-ignition-bundle/pull/15 54 | - Bump dependabot/fetch-metadata from 1.3.6 to 1.4.0 by @dependabot in https://github.com/spatie/symfony-ignition-bundle/pull/16 55 | - Bump dependabot/fetch-metadata from 1.4.0 to 1.5.1 by @dependabot in https://github.com/spatie/symfony-ignition-bundle/pull/17 56 | - added AI solution provider by @Nelwhix in https://github.com/spatie/symfony-ignition-bundle/pull/18 57 | 58 | ### New Contributors 59 | 60 | - @Nelwhix made their first contribution in https://github.com/spatie/symfony-ignition-bundle/pull/18 61 | 62 | **Full Changelog**: https://github.com/spatie/symfony-ignition-bundle/compare/0.0.2...0.0.3 63 | 64 | ## 0.0.2 - 2022-03-06 65 | 66 | ## What's Changed 67 | 68 | - Fix PHPUnit tests when run in GH actions by @amacrobert in https://github.com/spatie/symfony-ignition-bundle/pull/4 69 | - Bump dependabot/fetch-metadata from 1.1.1 to 1.2.0 by @dependabot in https://github.com/spatie/symfony-ignition-bundle/pull/5 70 | - Bump dependabot/fetch-metadata from 1.2.0 to 1.2.1 by @dependabot in https://github.com/spatie/symfony-ignition-bundle/pull/6 71 | 72 | **Full Changelog**: https://github.com/spatie/symfony-ignition-bundle/compare/0.0.1...0.0.2 73 | 74 | ## 0.0.1 - 2022-01-26 75 | 76 | - experimental release 77 | 78 | ## 1.0.0 - 202X-XX-XX 79 | 80 | - initial release 81 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # A beautiful error page for Symfony apps 2 | 3 | [![Latest Version on Packagist](https://img.shields.io/packagist/v/spatie/symfony-ignition-bundle.svg?style=flat-square)](https://packagist.org/packages/spatie/symfony-ignition-bundle) 4 | [![Tests](https://github.com/spatie/symfony-ignition-bundle/actions/workflows/run-tests.yml/badge.svg?branch=main)](https://github.com/spatie/symfony-ignition-bundle/actions/workflows/run-tests.yml) 5 | [![Total Downloads](https://img.shields.io/packagist/dt/spatie/symfony-ignition-bundle.svg?style=flat-square)](https://packagist.org/packages/spatie/symfony-ignition-bundle) 6 | 7 | [Ignition](https://github.com/spatie/ignition) is a beautiful and customizable error page for 8 | PHP applications 9 | 10 | Using this bundle, you can replace Symfony's default exception pages with Ignition. 11 | 12 | This is what how the Ignition looks like in the browser. 13 | 14 | ![Screenshot of ignition](https://spatie.github.io/ignition/ignition.png) 15 | 16 | There's also a beautiful dark mode. 17 | 18 | ![Screenshot of ignition in dark mode](https://spatie.github.io/ignition/ignition-dark.png) 19 | 20 | ## Support us 21 | 22 | [](https://spatie.be/github-ad-click/symfony-ignition-bundle) 23 | 24 | We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us). 25 | 26 | We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards). 27 | 28 | ## Installation 29 | 30 | You can install the package via composer: 31 | 32 | ```bash 33 | composer require --dev spatie/symfony-ignition-bundle 34 | ``` 35 | 36 | Enable the bundle in `config/bundles.php`: 37 | ```diff 38 | return [ 39 | // ... 40 | + Spatie\SymfonyIgnitionBundle\IgnitionBundle::class => ['dev' => true], 41 | ]; 42 | 43 | ``` 44 | 45 | ## Configuration 46 | 47 | Use `bin/console debug:config ignition` to see configuration options. 48 | 49 | `config/packages/ignition.yaml`: 50 | ```yaml 51 | when@dev: 52 | ignition: 53 | application_path: '%kernel.project_dir%' 54 | dark_mode: false 55 | should_display_exception: '%kernel.debug%' 56 | # if you want AI solutions to your app's errors 57 | openai_key: 'key-here' 58 | ``` 59 | 60 | ## Usage 61 | 62 | When you now throw an exception anywhere in your app... 63 | 64 | ```php 65 | class IndexController extends AbstractController 66 | { 67 | #[Route('/', name: 'index')] 68 | public function index(): Response 69 | { 70 | throw new Exception('Hello Ignition!'); 71 | } 72 | } 73 | ``` 74 | 75 | ... you'll see a beautiful error page. 76 | 77 | ![screenshot](https://spatie.github.io/symfony-ignition-bundle/images/ignition.png) 78 | 79 | To learn all the options that Ignition provides, including error reporting to [Flare](https://flareapp.io), head over to [the readme of spatie/ignition](https://github.com/spatie/ignition#usage). 80 | 81 | ## Testing 82 | 83 | ```bash 84 | composer test 85 | ``` 86 | 87 | ## Changelog 88 | 89 | Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. 90 | 91 | ## Contributing 92 | 93 | Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details. 94 | 95 | ## Security Vulnerabilities 96 | 97 | Please review [our security policy](../../security/policy) on how to report security vulnerabilities. 98 | 99 | ## Credits 100 | 101 | - [Andrew MacRobert](https://github.com/amacrobert) 102 | - [Freek Van der Herten](https://github.com/freekmurze) 103 | - [All Contributors](../../contributors) 104 | 105 | ## License 106 | 107 | The MIT License (MIT). Please see [License File](LICENSE.md) for more information. 108 | --------------------------------------------------------------------------------