reusablecog / error-dictionary-bundle
1.0.0
2023-12-05 12:34 UTC
Requires
- symfony/config: ^6.0|^7.0
- symfony/dependency-injection: ^6.0|^7.0
- symfony/http-kernel: ^6.0|^7.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.37
- pedrotroller/php-cs-custom-fixer: ^2.33
- phpstan/extension-installer: ^1.3
- phpstan/phpstan: ^1.10
- phpstan/phpstan-strict-rules: ^1.5
- symfony/twig-bundle: ^6.0|^7.0
README
错误字典组件
错误字典组件是一个用于简化错误管理页面生成的Symfony组件。通过填写YAML配置文件,您只需简单操作即可显示错误描述、相关代码、异常和响应代码。
安装
您可以使用Composer安装ErrorDictionary。
composer require reusablecog/error-dictionary-bundle
功能
- 错误定义配置:在YAML配置文件中定义错误代码、标签、描述、分类、状态代码和相关异常。
- 易于集成:无缝地将错误管理页面集成到您的Symfony项目中。
用法
要使用错误字典组件,您需要在配置文件中定义错误代码及其详细信息。以下是一个示例:
#config/packages/error_dictionary.yaml error_dictionary: error_definition: '999999': label: The resource was not found in database. description: The resource was not found in database. category: Home status_code: 404 exception: ResourceNotFound '9E8302': label: Incorrect payload for the registration API. description: In the registration API all fields are required. category: Account status_code: 400 exception: BadRequest
版本
贡献
如果您遇到任何问题或想为错误字典组件做出贡献,请随意在GitHub仓库上创建pull request或提交issue。
许可证
错误字典组件是开源软件,根据MIT许可证发布。