Download the PHP package bakame/aide-error without Composer

On this page you can find all versions of the php package bakame/aide-error. 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 aide-error

Aide for Errors

A Cloak system to help dealing with error reporting in PHP.

[!CAUTION]
Sub-split of Aide for Error.
⚠️ this is a sub-split, for pull requests and issues, visit: https://github.com/bakame-php/aide

Installation

Composer

composer require bakame-php/aide-error

System Requirements

You need:

Usage

Traditionally to correctly handle errors with PHP's functions you have two (2) options. Either you use the @ to suppress the error which is not recommended; or you need to add some boilerplate code around set_error_handler and restore_error_handler.

The Bakame\Aide\Error\Cloak utility class helps you remove that burden by doing the heavy-lifting for you.

`

You can control its behaviour on your global codebase

`

Or you can decide to specifically change its default behaviour for a specific call.

`

Available properties and methods

Accessing the error

To access the errors store in the instance you need to call the Cloak::errors method which will return a CloakedErrors instance. This container gives you can access all the ErrorException generated during the last execution of the callback. If no error occurred during the last execution of the class, the CloakedErrors instance will be empty.

Controlling when to throw or not your errors.

The class general behaviour is controlled by two (2) static methods. In all cases if an error occurred, it is converted into an ErrorException and will be made accessible via the Cloak::errors method. The difference being that with:

[!NOTE] to respect PHP's behaviour, Cloak uses Cloak::silentOnError by default

Named constructors

To ease usage the named constructors are added:

They all share the same signature:

the $onError argument is used to tweak the instance behaviour on error:

If you really need other fined grained error level you can still use the constructor as shown below:

ReportingLevel class

Because dealing with PHP error reporting level can be confusing sometimes, the package ships with an friendlier approach to deal with them. As an example, the previous code example can be rewritten using the ReportingLevel class.

The class exposes a friendlier API to ease working with error reporting level:

on top of that the class expose a construct for each error reporting level using the following syntax:

You can tell which error reporting is being configured using the contains method. The class also provides the excluded and included methods which returns the error reporting level names.

Accessing the Error Reporting Level from a Cloak instance

Once instantiated, you can always access the error reporting level via the errorLevel method on a Cloak instance. For example, if you need to know if a specific error is included you can do the following:

Credits


All versions of aide-error with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
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 bakame/aide-error contains the following files

Loading the files please wait ....