Download the PHP package smuuf/better-php-exceptions without Composer

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

Better PHP Exceptions

What is it about?

This small project aims to provide improved user/developer experience for PHP developers working with native PHP exceptions (thrown by the PHP interpreter itself in various situations).

Better PHP Exceptions can be created from native exceptions via unified interface:

As an example scenario, both PHP 7.* and PHP 8.0 throw TypeError exceptions in three distinct scenarios:

There are three scenarios where a TypeError may be thrown. The first is where the argument type being passed to a function does not match its corresponding declared parameter type. The second is where a value being returned from a function does not match the declared function return type. The third is where an invalid number of arguments are passed to a built-in PHP function (strict mode only).

~ https://www.php.net/manual/en/class.typeerror.php

Sadly, PHP or the TypeError itself does not provide any additional information about the types expected, types passed/returned, or at which position the passed wrong type was present during invocation.

Was it an argument type error? A return type error? What was it...!?

This information is present only in the exception message and it takes an extra parsing effort to get it. Not to mention the fact that the format of these messages changed from PHP 7 to PHP 8 and thus need different parsing rules...

This is where Better PHP Exceptions come in.

Example

Which PHP versions?

Even though PHP 8.0 was released near the end of 2020, PHP 7 is still used extensively and Better PHP Exceptions aim to provide better exceptions for both current major PHP versions (at least for now).

Which native PHP exceptions can be made better?

Currently only a handful (in the beginning it was just a single one, since I needed that for my other project: Primi language: A scripting language written in PHP). But the system is built to support easy addition of more better exceptions.

So... which ones?


All versions of better-php-exceptions with dependencies

PHP Build Version
Package Version
Requires php 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 smuuf/better-php-exceptions contains the following files

Loading the files please wait ....