Download the PHP package timefrontiers/php-instance-error without Composer
On this page you can find all versions of the php package timefrontiers/php-instance-error. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download timefrontiers/php-instance-error
More information about timefrontiers/php-instance-error
Files in timefrontiers/php-instance-error
Package php-instance-error
Short Description PHP Instance Error handler with access-based filtering
License MIT
Homepage https://github.com/timefrontiers/php-instance-error
Informations about the package php-instance-error
TimeFrontiers PHP Instance Error
InstanceError is the standard reader and access-rank filter for error
collections produced by TimeFrontiers\Helper\HasErrors. It preserves the
established five-element tuple and context grouping used across TimeFrontiers
packages.
Installation
The package requires timefrontiers/php-error-log, so the public log() API is
available after every normal Composer installation. timefrontiers/php-session
remains optional; without a valid global session, extraction defaults to guest
rank.
Canonical error shape
Every accepted error is a five-element list:
Errors are grouped by a non-empty context:
Malformed contexts and tuples are rejected during extraction. In particular, a missing or invalid minimum rank never defaults to guest. Safe integer-like strings in numeric tuple positions are normalized to integers; fields are not invented when missing.
Extracting errors for display
Objects using HasErrors::getErrors() are supported directly. A public legacy
$errors property is used only when there is no callable getter.
get('', true) does not flatten across contexts. It returns grouped message
lists:
Helper methods operate only on entries visible to the resolved rank:
Rank filtering is defense in depth, not secret scrubbing. Public responses must not contain SQL, stack traces, absolute paths, provider payloads, credentials, tokens, cookies, authorization headers, card data, or raw driver messages.
Rank resolution
The effective visibility rank is resolved in this order:
- An explicit
AccessRankconstructor override. - An explicit integer constructor override.
true, which deliberately bypasses filtering withPHP_INT_MAX.- The callable global
$session->access_rank()method. - A public legacy global
$session->access_rankproperty. AccessRank::GUEST->value.
Session method/property results may be an AccessRank, integer, or integer-like
string. Invalid, negative, inaccessible, or throwing session values fail to
guest. Future integer ranks are not capped; the current enum includes
AccessRank::OWNER at rank 14.
Explicit rank overrides, the true bypass, and all() are trusted server-side
technical/debug operations. Never populate an override from a query parameter,
form field, header, token claim, or any other untrusted request input. Never
return all() or unrestricted output in a public response.
Technical logging
log() applies the extractor's current visibility rank and writes one
ResponseStatus::PROCESS_ERROR record per selected context. Each log detail
keeps the tuple's own code separate from the response-status prefix.
A supplied context that does not exist, a failed write, or a logger exception
returns false and adds a safe developer-visible diagnostic to the extractor's
own HasErrors collection.
Logging does not make secrets safe to store. The logger protects its record delimiters, but application and package code must prevent credentials, tokens, card data, raw provider payloads, and other secrets from entering error messages in the first place.
Adding canonical errors
put() is a programmer-facing API. It throws InvalidArgumentException for a
blank context or malformed tuple.
Using HasErrors
The current protected _addError() signature is:
Development
Dependencies
- PHP 8.5 or newer
timefrontiers/php-coretimefrontiers/php-has-errorstimefrontiers/php-error-log- Optional:
timefrontiers/php-sessionfor global session-rank resolution
License
MIT
All versions of php-instance-error with dependencies
timefrontiers/php-core Version ^1.0
timefrontiers/php-error-log Version ^1.0
timefrontiers/php-has-errors Version ^1.0