A lightweight, framework-agnostic collection of well-defined exception classes that extend PHP's native Exception. Each type represents a clear, specific error scenario โ making error handling more expressive, consistent and easier to maintain.
๐ Documentation
You are currently browsing the auto-generated API reference (phpDocumentor).
- ๐ Online API documentation
- ๐ Changelog
๐ฆ Installation
This library requires PHP 8.4+ and is installed via Composer:
composer require oihana/php-exceptions
โจ Features
- ๐ Ready-to-use exception classes for common application errors.
- ๐งฉ Extends the standard
Exceptionclass where relevant. - ๐ HTTP error exceptions (
Error400โฆError500) with sensible default messages and status codes. - ๐ Improves code readability and error semantics.
- โก Lightweight with zero external dependencies.
- ๐ฆ Easily integrable in any PHP project or framework.
โ Tests & coverage
Run the unit-test suite (PHPUnit, strict mode):
composer test
Measure coverage (requires Xdebug or PCOV):
composer coverage composer coverage:md
๐งพ License
This project is licensed under the Mozilla Public License 2.0 (MPL-2.0).
๐ค About the Author
- Name: Marc ALCARAZ (aka eKameleon)
- Website: www.ooop.fr
- Email: marc@ooop.fr
๐ Related packages
- oihana/php-core โ core helpers and utilities used across the Oihana libraries.
๐ Project on GitHub
View the full source code and contribute on GitHub: github.com/BcommeBois/oihana-php-exceptions.