定制 makararoth/filament-react-error-pages 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

makararoth/filament-react-error-pages

Composer 安装命令:

composer require makararoth/filament-react-error-pages

包简介

A Laravel package that provides React-based custom error pages with Filament support

README 文档

README

A Laravel package that provides React-based custom error pages with Filament admin panel integration.

Latest Version on Packagist GitHub Tests Action Status Total Downloads License

Features

  • Custom React-powered error pages for your Laravel application
  • Seamless integration with Filament admin panel
  • TypeScript support for better development experience
  • Customizable styles and configurations
  • Easy to extend with your own error components

Screenshots

Coming soon

Installation

Prerequisites

  • PHP 8.1 or higher
  • Laravel 10.0 or higher
  • Filament 3.0 or higher (for Filament integration)
  • Node.js and npm/yarn (for building React components)

Via Composer

composer require ch-makara-roth/filament-react-error-pages

Publish Assets and Config

php artisan vendor:publish --tag=filament-react-error-pages-config
php artisan vendor:publish --tag=filament-react-error-pages-assets

Troubleshooting Installation

If you encounter an error during the artisan filament:upgrade command after installation that indicates missing asset files, please ensure you're using the latest version of the package:

composer require makararoth/filament-react-error-pages:^0.1.5

The error might look like:

ErrorException: copy(...): Failed to open stream: No such file or directory

This issue was fixed in version 0.1.5 by ensuring the required asset files are properly published and available in the correct location.

If you're still experiencing issues after upgrading, you may need to manually publish the assets:

php artisan vendor:publish --tag=filament-react-error-pages-assets --force

This will ensure the CSS and JavaScript files are properly published to your application.

Configuration

After publishing the configuration file, you can customize the error pages in the config/filament-react-error-pages.php file:

// 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',
],

Usage

Basic Usage

Once installed and configured, the package will automatically replace Laravel's default error pages with React-powered custom error pages.

Custom Error Pages

You can create your own custom error components by:

  1. Creating React components in your application
  2. Registering them in the configuration:
'error_components' => [
    404 => 'MyCustomNotFoundPage',
    500 => 'MyCustomServerErrorPage',
],

Usage in Blade Templates

You can render error pages manually in your Blade templates:

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

Filament Integration

When Filament integration is enabled, the package will provide custom error pages within the Filament admin panel. Example usage:

// 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();
}

Customization

Styling the Error Pages

You can customize the appearance of error pages by:

  1. Modifying the config file
  2. Creating custom React components
  3. Publishing and editing the views

Supported Error Codes

  • 400 (Bad Request)
  • 401 (Unauthorized)
  • 403 (Forbidden)
  • 404 (Not Found)
  • 419 (Page Expired)
  • 429 (Too Many Requests)
  • 500 (Server Error)
  • 503 (Service Unavailable)

Testing

composer test
npm test

Changelog

Please see CHANGELOG.md for more information on what has changed recently.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

For Maintainers

Releasing a New Version

When releasing a new version of this package, follow these steps to ensure assets are properly included:

  1. Make your changes to the codebase
  2. Run the build process to generate assets:
    npm run build
  3. Check that the following files exist and have content:
    • dist/js/app.js
    • dist/css/app.css
    • public/js/app.js
    • public/css/app.css
  4. Update the version number in package.json
  5. Update the CHANGELOG.md with details of the changes
  6. Commit all changes, including the built assets in the dist directory
  7. Tag the release with the new version number
  8. Push to the repository with tags:
    git push --tags
  9. The package will automatically update on Packagist

Important: Do not ignore the /dist directory in .gitignore. The built assets must be included in the repository for the package to work correctly when installed via Composer.

Security Vulnerabilities

If you discover a security vulnerability, please send an e-mail to Makara Roth via your-email@example.com. All security vulnerabilities will be promptly addressed.

Credits

License

The MIT License (MIT). Please see License File for more information.

makararoth/filament-react-error-pages 适用场景与选型建议

makararoth/filament-react-error-pages 是一款 基于 TypeScript 开发的 Composer 扩展包,目前已累计 7 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 05 月 20 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 makararoth/filament-react-error-pages 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 makararoth/filament-react-error-pages 我们能提供哪些服务?
定制开发 / 二次开发

基于 makararoth/filament-react-error-pages 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 7
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 7
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: TypeScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-05-20