Download the PHP package aslnbxrz/simple-exception without Composer
On this page you can find all versions of the php package aslnbxrz/simple-exception. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package simple-exception
SimpleException โ Laravel Package
A modern exception handling package for Laravel with enum-based error codes, automatic translation sync, and clean JSON API responses.
๐ Features
- โ
Enum-based error codes (e.g.
MainRespCode,UserRespCode) - โ
Helper functions:
error(),error_if(),error_unless(),error_response() - โ
Automatic translation sync: keep enum cases in sync with
lang/files - โ Configurable: response structure, error keys, caching
- โ Laravel-ready: Service provider, config publish, artisan commands
- โ Works with Laravel 9 โ 12+
๐ฆ Installation
Publish config:
This creates config/simple-exception.php.
โ๏ธ Configuration
Example
๐ฏ Quick Start
Step 1 โ Generate an Enum
This creates:
app/Enums/RespCodes/UserRespCode.phplang/vendor/simple-exception/en/user.phplang/vendor/simple-exception/uz/user.php
Step 2 โ Throw Errors
Step 3 โ Example Controller
๐ Translation Management
Sync all enums
Sync one enum
Output:
Example Translation File
lang/vendor/simple-exception/en/user.php
๐จ Response Format
Success
Error
Error (Debug mode)
๐ Available Commands
| Command | Description |
|---|---|
php artisan make:resp-code {name} |
Generate a new error enum (with translations) |
php artisan sync:resp-translations {enum?} |
Sync translations for a single enum or all enums |
php artisan vendor:publish --tag=simple-exception-config |
Publish package config |
๐งช Testing
Runs all package unit tests (artisan commands, exception handling, translation sync).
๐ Changelog
-
v1.1.0
- Added
make:resp-codecommand with--casesand--locale - Unified translation folder structure:
lang/vendor/simple-exception/{locale}/{file}.php - Improved helper functions (
error_if,error_unless, etc.) - Cleaner
SimpleErrorResponseAPI:resolvedHttpCode(),resolvedCode()
- Added
- v1.0.x
- Initial release with enum-based exceptions and helpers
๐ค Contributing
- Fork
- Create feature branch
- Commit changes
- Open PR
๐ License
MIT ยฉ aslnbxrz
All versions of simple-exception with dependencies
PHP Build Version
Package Version
Requires
php Version
^8.2
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/http Version ^10.0|^11.0|^12.0
illuminate/validation Version ^10.0|^11.0|^12.0
illuminate/console Version ^10.0|^11.0|^12.0
symfony/http-foundation Version ^6.0|^7.0
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/http Version ^10.0|^11.0|^12.0
illuminate/validation Version ^10.0|^11.0|^12.0
illuminate/console Version ^10.0|^11.0|^12.0
symfony/http-foundation Version ^6.0|^7.0
The package aslnbxrz/simple-exception contains the following files
Loading the files please wait ...