Download the PHP package margusk/warbsorber without Composer

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

Tests

Warbsorber (Warnings absorber)

The Problem

Many built-in PHP functions emit warning messages in case of failures. It's done very dirty - echoing directly to output and catchable only when having an special error handler installed.

Modern (proper) way to transfer failure details would be of course by using Exceptions but due legacy reasons that's not possible for lot's of old built-in functions and will probably never be "fixed".

The Solution

This library provides a wrapper for executing arbitrary codeblock, which has tendency to spit out warnings, notices or errors.

All those messages are "absorbed" by the wrapper and returned nicely after the codeblock is executed for later inspection.

Requirements

Requires:

Installation

Install with composer:

Usage

Output:

The code above shows how we're calling fopen which is destined to fail. Instead of just getting false as return value we also catch textual reasons why the call failed. Those reasons can be later presented to end user for fixing.

Remove function name from the beginning of message

What if we want to concatenate all messages into single paragraph? We already know that the messages are related to fopen() so message beginnings (fopen(): and fopen(php://non-existent-stream):) are actually irrelevant and excessive information.

Let's get rid of them by using removeFunctionPrefix(string $funcName) method:

Now the output is much cleaner:

Note that $fopenWarnings is immutable object, which makes removeFunctionPrefix to return cloned instance with modified data.

Catch messages only with specific error levels

By default all messages regardless of level (e.g. E_WARNING, E_NOTICE etc.) are catched during codeblock execution. However this can be changed if needed by adding second parameter to Warbsorber call:

This catches only messages with level E_WARNING, E_NOTICE or E_DEPRECATED

Documentation

Main wrapper Warbsorber(\Closure $callback, int $level = E_ALL): Warnings; returns instance of margusk\Warbsorber\Warnings

Class margusk\Warbsorber\Warnings

Class margusk\Warbsorber\Entry

License

This library is released under the MIT License.


All versions of warbsorber with dependencies

PHP Build Version
Package Version
Requires php Version ^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 margusk/warbsorber contains the following files

Loading the files please wait ...