Download the PHP package maplephp/blunder without Composer

On this page you can find all versions of the php package maplephp/blunder. 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?
maplephp/blunder
Rate from 1 - 5
Rated 5.00 based on 1 reviews

Informations about the package blunder

MaplePHP Blunder

Screen dump on how blunder looks like

Blunder is a pretty error handling framework for PHP. It provides a pretty, user-friendly interface that simplifies debugging with excellent memory management. Blunder offers various handlers, including HTML, JSON, XML, CLI, plain text, and silent modes, allowing flexible error presentation. Seamlessly integrating with tools like the PSR-7 and PSR-3 compliant MaplePHP Log library, Blunder is an excellent choice for managing errors in PHP applications, helping users easily identify and resolve issues.

With Blunder, you can easily control how errors are handled—whether you want to suppress specific severities, redirect them to logging, or assign them to different handlers. For example, you can automatically log all Deprecated warnings while keeping Warnings visible for debugging. This level of customization ensures a smooth and efficient error-handling experience tailored to your needs.

Installation

Installation with composer

Pretty Example

Here is a simple example to load the pretty error interface:

Handlers

All handlers utilize the namespace MaplePHP\Blunder\Handlers\[TheHandlerName].

Excluding Specific Error Severities from the Handler

With Blunder, you can exclude specific error severities from the handler. This allows you to control how certain errors are processed without affecting the overall error handling behavior.

1. Exclude Severity Levels

This method removes the specified severities from Blunder’s handler, allowing them to be processed by PHP’s default error reporting.

Effect:


2. Exclude and Redirect Severities

Instead of letting PHP handle the excluded severities, you can redirect them to a custom function for further processing, such as logging.

Behavior:

Example Use Case:


3. Redirect Excluded Severities to a New Handler

You can also redirect excluded severities to a completely different error handler.

Effect:


Note:
You can find a full list of available PHP error severities here.


Enabling or Disabling Trace Lines

This allows you to control the level of detail shown in error messages based on your debugging needs. You can customize this behavior using the configuration:

Options:

This allows you to control the level of detail shown in error messages based on your debugging needs.

Remove location headers

This will remove location headers and make sure that no PHP redirect above this code will execute.

Setting the Exit Code for Errors

To make Blunder trigger a specific exit code when an error occurs. This is useful in unit testing and CI/CD, ensuring tests fail on errors.

Event Handling

You can use Blunder's event functionality to handle errors, such as logging them to a file. The example below shows how to display a pretty error page in development mode and log errors in production.

1. Install MaplePHP Log

We use MaplePHP Log in the example, a PSR-3 compliant logging library.

2. Create an Event

Here is a complete example with explanatory comments.

HTTP Messaging

The Blunder Run class can take two arguments. The first argument is required and should be a class handler (HandlerInterface). The second argument is optional and expects an HTTP message class used to pass an already open PSR-7 response and ServerRequest instance instead of creating a new one for better performance.

Exception Chaining

When rethrowing an exception with a different type, PHP resets the file and line number to the location of the new throw statement. This can make debugging harder, as the error message will point to the wrong file instead of the original source of the exception.

To preserve the original exception’s file and line number while changing its type, you can use the preserveExceptionOrigin method provided by Blunder.

Example: Preserving the Original Exception’s Location


All versions of blunder with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
maplephp/http Version ^1.0
maplephp/prompts Version ^1.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 maplephp/blunder contains the following files

Loading the files please wait ....