spiral-packages / yii-error-handler-bridge
Yii Error Handler integration package for Spiral Framework
Package info
github.com/spiral-packages/yii-error-handler-bridge
pkg:composer/spiral-packages/yii-error-handler-bridge
Fund package maintenance!
Requires
- php: ^8.2
- spiral/boot: ^3.15
- spiral/exceptions: ^3.15
- yiisoft/error-handler: 4.3.2
Requires (Dev)
- bamarni/composer-bin-plugin: ^1.8
- buggregator/trap: ^1.13
- llm/skills: ^1.16
- mockery/mockery: ^1.6.12
- roxblnfk/unpoly: ^1.8
- spiral/http: ^3.0
- testo/bridge-infection: ^0.1.9
- testo/bridge-mockery: ^0.1.2
- testo/testo: ^0.10.56
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Yii error renderers for Spiral Framework
This package plugs the yiisoft/error-handler renderers into the Spiral exception handler, so exceptions are rendered as HTML, JSON, XML or plain text depending on the requested format and verbosity level.
Get Started
Installation
composer require spiral-packages/yii-error-handler-bridge
Requirements: PHP 8.2+ and Spiral Framework 3.15+.
Configuration
Register the bootloader in your application kernel:
public function defineBootloaders(): array { return [ // ... \Spiral\YiiErrorHandler\Bootloader\YiiErrorHandlerBootloader::class, // ... ]; }
See the documentation for details on renderers and verbosity levels.
Acceptance Test Sandbox
This package includes an acceptance test sandbox that demonstrates how the different error renderers work with various verbosity levels. The sandbox provides a simple web interface to visualize errors rendered in HTML, JSON, XML, and Plain Text formats.
Running the Sandbox
You can run the sandbox using Composer:
composer sandbox
Or manually start the PHP built-in web server from the project root:
php -S localhost:8000 tests/Acceptance/server.php
Then open your browser and navigate to http://localhost:8000
The interface allows you to select different renderer types (HTML, JSON, Plain Text, XML) and verbosity levels (Basic, Verbose, Debug) to see how exceptions are presented in each format.
This sandbox is useful for testing and understanding how the error renderers work in different scenarios without needing to integrate them into a full application.
