Download the PHP package maatify/exceptions without Composer
On this page you can find all versions of the php package maatify/exceptions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download maatify/exceptions
More information about maatify/exceptions
Files in maatify/exceptions
Package exceptions
Short Description Policy-driven, escalation-aware exception library for PHP applications.
License MIT
Homepage https://github.com/Maatify/exceptions
Informations about the package exceptions
maatify/exceptions
Enterprise-grade, hardened exception handling library for PHP applications.
maatify/exceptions provides a strictly typed, immutable taxonomy for application errors, enforcing semantic correctness, security, and consistent HTTP mapping. It is designed to prevent "taxonomy drift" and ensure that critical system errors are never masked by lower-severity wrappers.
🚀 Key Features
- Strict Taxonomy: Exceptions are categorized into 9 distinct families (System, Validation, Auth, etc.) backed by
ErrorCategoryEnum. - Guarded Overrides: Prevents developers from accidentally mismatching error codes or HTTP statuses.
- Escalation Protection: Automatically escalates severity when a critical exception is wrapped in a lighter one (e.g., a Database failure wrapped in a generic runtime exception will typically retain 500 status).
- Error Serialization: Transforms any
Throwableinto a standardized, deterministic JSON response suitable for APIs. - RFC7807 Support: Built-in formatter for "Problem Details for HTTP APIs" compliance.
- Zero Dependencies: Pure PHP implementation. No framework coupling.
- PSR-4 Compliant: Ready for immediate Composer autoloading.
Requirements
- PHP 8.2+
📦 Installation
📖 Usage
Basic Usage
Throwing a predefined exception:
Advanced Usage (Wrapping)
When catching a low-level error and re-throwing, the library automatically handles severity escalation:
Error Serialization
Convert any exception into a ready-to-send API response:
📚 Documentation
Detailed documentation is available in the BOOK/ directory:
- Introduction
- Architecture
- Taxonomy
- Exception Families
- Override Rules
- Escalation Protection
- Security Model
- Best Practices
- Extending The Library
- API Integration Guide
- Testing Strategy
- Versioning Policy
- Packagist Metadata
🛡️ Guarantees
- Category Immutability: An exception's category is defined by its class and cannot be overridden at runtime.
- Status Class Safety: You cannot force a 4xx exception to return a 5xx status code manually, or vice versa.
- Escalation Determinism: Severity calculation is deterministic and side-effect free.
- Serialization Determinism: The same input Throwable and Context will always yield the exact same output.
✅ Quality Status
- PHP 8.2+
- PHPUnit 11
- 100% Code Coverage
- Zero Warnings
- Immutable Exception Design
- Deterministic Escalation & Policy Engine
🪪 License
This library is licensed under the MIT License.
See the LICENSE file for details.
👤 Author
Engineered by Mohamed Abdulalim (@megyptm)
Backend Lead & Technical Architect
https://www.maatify.dev
🤝 Contributors
Special thanks to the Maatify.dev engineering team and all open-source contributors.
Contributions are welcome.
Built with ❤️ by Maatify.dev — Unified Ecosystem for Modern PHP Libraries