PHP code example of makararoth / filament-react-error-pages

1. Go to this page and download the library: Download makararoth/filament-react-error-pages library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

makararoth / filament-react-error-pages example snippets


// Enable or disable custom error pages
'use_custom_error_pages' => true,

// Enable or disable Filament integration
'use_in_filament' => true,

// Customize styles and appearance
'styles' => [
    'theme' => 'system',
    'colors' => [
        'primary' => '#3b82f6',
        // ...
    ],
    // ...
],

// Global props for all error components
'global_props' => [
    'back_button_text' => 'Go Back',
    'home_button_text' => 'Go to Homepage',
    // ...
],

// Custom components for specific error codes
'error_components' => [
    404 => 'CustomNotFoundPage',
    500 => 'CustomServerErrorPage',
],

'error_components' => [
    404 => 'MyCustomNotFoundPage',
    500 => 'MyCustomServerErrorPage',
],

{!! app('filament-react-error-pages')->render(404, [
    'message' => 'The page you were looking for could not be found.',
    'companyName' => config('app.name'),
    'supportEmail' => '[email protected]',
]) !!}

// In a Filament page or resource
public function render()
{
    try {
        // Your code that might throw an exception
    } catch (\Exception $e) {
        return view('filament-react-error-pages::examples.filament-integration', [
            'errorCode' => 500,
            'message' => 'An error occurred while processing your request.',
        ]);
    }
    
    return parent::render();
}
bash
php artisan vendor:publish --tag=filament-react-error-pages-config
php artisan vendor:publish --tag=filament-react-error-pages-assets
bash
php artisan vendor:publish --tag=filament-react-error-pages-assets --force