Download the PHP package componenta/error-handler without Composer

On this page you can find all versions of the php package componenta/error-handler. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package error-handler

Componenta Error Handler

HTTP and CLI error handling for PHP 8.4+ applications.

The package contains the reusable error handling layer. It does not choose a concrete PSR-7/PSR-17 implementation. HTTP applications must register Psr\Http\Message\ResponseFactoryInterface through one of the componenta/http-psr-* integration packages or provide a custom HttpErrorResponseGeneratorInterface.

Installation

The package declares Componenta\Error\ConfigProvider in extra.componenta.config-providers. When componenta/composer-plugin is installed, the provider is added to the generated provider list automatically.

Related Packages

Package Why it matters here
componenta/http Provides HTTP exception types; PSR request/response integration is implemented by the HTTP error handler and app packages.
componenta/pipeline Usually runs ErrorHandlerMiddleware as the outermost HTTP middleware.
componenta/event Can be used for error reporting listeners.
psr/log Fits logging listeners and reporters.
componenta/config Registers default HTTP/CLI handlers, renderers, and reporters.
componenta/http-psr-nyholm, componenta/http-psr-diactoros, componenta/http-psr-guzzle, or componenta/http-psr-slim Registers the concrete PSR-17 factories used by HTTP response generation.

What It Provides

HTTP Usage

Register specialized generators with priorities:

Higher priority generators are checked first.

Custom generators implement HttpErrorResponseGeneratorInterface:

HttpErrorResponseGenerator resolves the response status once through HttpStatusResolver and writes it to the context as ErrorContextAttribute::HTTP_STATUS_CODE before rendering. The default resolver uses HttpStatusAwareInterface, then an exception code in the 400..599 range, then 500.

CLI Usage

Renderers

Built-in renderers:

Fallback generators use safe defaults: HTTP uses SafeRenderer, CLI uses PlainTextRenderer.

Additional renderer integrations live in separate packages:

Package Renderer Typical use
componenta/error-renderer-plates PlatesRenderer Safe or custom HTML error pages rendered with League Plates templates.
componenta/error-renderer-whoops WhoopsRenderer Detailed development error pages through Whoops.
componenta/error-renderer-symfony SymfonyRenderer Symfony error page rendering adapted to ErrorRendererInterface.
componenta/error-renderer-ignition IgnitionRenderer Spatie Ignition development error pages.
componenta/error-renderer-collision CollisionRenderer Rich CLI error output through Collision.

Contexts

Contexts carry request or command-line information plus arbitrary attributes.

Context objects are immutable: withAttribute() and withAttributes() return a new instance.

HttpContext::fromGlobals() does not create PSR-17 factories by itself. Pass a Nyholm\Psr7Server\ServerRequestCreatorInterface when a context must be built from PHP superglobals:

Reporting

Register listeners for logging or monitoring:

Specific exceptions can be excluded from reporting by class name or predicate.

ErrorReporter accepts a ListenerExceptionPolicy. The default policy swallows listener failures and writes them through error_log(), so error reporting cannot replace the original application exception with a logging failure.

DI Registration

ConfigProvider registers the HTTP/CLI handlers, renderers, reporter, and middleware dependencies needed by Componenta applications.

Important config keys:

Key Purpose
ConfigKey::HTTP_FALLBACK_GENERATOR Service id for the fallback HttpErrorResponseGeneratorInterface.
ConfigKey::HTTP_RENDERER Renderer used by the default HTTP response generator.
ConfigKey::HTTP_GENERATORS Ordered service ids for specialized HTTP response generators.
ConfigKey::HTTP_LISTENERS HTTP error listeners.
ConfigKey::CLI_FALLBACK_HANDLER CLI fallback renderer/handler.
ConfigKey::CLI_RENDERER CLI renderer.
ConfigKey::CLI_LISTENERS CLI error listeners.
ConfigKey::ERROR_REPORTER Reporter service.
ConfigKey::ERROR_ID_GENERATOR Error id generator service.
ConfigKey::ERROR_LEVEL Error level handled by ErrorHandlerMiddleware.

If no ConfigKey::HTTP_FALLBACK_GENERATOR is configured, the default HTTP handler requires Psr\Http\Message\ResponseFactoryInterface in the container.


All versions of error-handler with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
ext-mbstring Version *
componenta/config Version ^1.0
nyholm/psr7-server Version ^1.1
psr/container Version ^2.0
psr/http-factory Version ^1.1
psr/http-message Version ^2.0
psr/http-server-middleware Version ^1.0
symfony/console Version ^7.4 || ^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package componenta/error-handler contains the following files

Loading the files please wait ...