Releases: HRADigital/php-exceptions
Release list
1.0.2
Full Changelog: 1.0.1...1.0.2
1.0.1
1.0.0
v1.0.0 — Initial release
First standalone release of hradigital/php-exceptions, extracted from hradigital/php-datatypes so it can evolve independently and be reused across
any PHP 8.1+ project.
A curated set of semantic, HTTP-aligned domain exceptions for Domain-Driven Design applications. Framework-agnostic, zero runtime dependencies
beyond the PHP standard library.
Highlights
- AbstractBaseException — single abstract base extending \DomainException. Carries an optional structured data payload (getData() / hasData()) and
forwards an optional inner Throwable. One catch captures every exception in the package. - HTTP-aligned $code — each subclass defaults its $code to the matching HTTP 4XX/5XX status, so the transport boundary can map exception → response
without a translation table. - Sensible default messages — every subclass ships with an intent-revealing default; override per-throw when you need specifics.
- Specialised RequestFailureException — extends UnprocessableEntityException (422) and carries structured per-field validation failures via
getFailures() / getFailedMessages(), with a withFailures() factory.
Available exceptions
Client — caller-fault (4XX-aligned)
BadRequestException (400), DeniedAccessException (401), PaymentRequiredException (402), ForbiddenException (403), NotFoundException (404),
MethodNotAllowedException (405), NotAcceptableException (406), RequestTimeoutException (408), ConflictException (409), GoneException (410),
PreconditionFailedException (412), UnsupportedMediaTypeException (415), RequestedRangeNotSatisfiableException (416), ExpectationFailedException
(417), UnprocessableEntityException (422), LockedException (423), FailedDependencyException (424), TooEarlyException (425),
PreconditionRequiredException (428), TooManyRequestsException (429), UnavailableForLegalReasonsException (451), plus
Request\RequestFailureException for structured field-level validation errors.
Server — system-fault (5XX-aligned)
InternalServerErrorException (500), ServerNotImplementedException (501), BadGatewayException (502), ServerUnavailableException (503),
GatewayTimeoutException (504), InsufficientStorageException (507), LoopDetectedException (508).
Transport-only HTTP statuses (407, 411, 413, 414, 421, 426, 431, 505, 506, 510, 511) are intentionally not represented — they have no
platform-agnostic domain meaning.
Requirements
- PHP ^8.1
Quality
- 236 unit tests, 297 assertions — every exception covered for parent class, default code, default/overridden message, data payload, and inner
exception forwarding. - CI runs PHPUnit on PHP 8.1 / 8.2 / 8.3 / 8.4 with pcov.
Install
composer require hradigital/php-exceptions