Download the PHP package squirrelphp/debug without Composer

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

Squirrel Debug

Build Status Test Coverage PHPStan Packagist Version PHP Version

Provides backtracing functionality to enable libraries to find the true origin of a problem (as opposed to where it becomes a problem) even if it is not know in what context the library/component is being used, and includes an exception base class for adding the origin data when throwing exceptions. Also provides an easy way of dumping debug data and function arguments in a shortened form. This is a helper library created for the other squirrel libraries, but it can be useful in any library or application.

Installation

composer require squirrelphp/debug

Finding the origin method call

When using libraries and abstractions it often is not relevant where a problem occurs (leading to an exception or warning), but where in the application the relevant call was made to the library/component that then causes the problem.

Squirrel\Debug\Debug::findOrigin goes through the debug backtrace and finds the relevant method call that lead to the current point in the application. You can (and should) provide classes/interfaces and namespaces it should ignore (to go back further and find the method call that preceded it). This method returns an Origin object which includes the file and line of the origin together with the method call (and its arguments).

Creating an OriginException

Squirrel\Debug\Debug::createException uses Squirrel\Debug\Debug::findOrigin to find the origin of the current problem and then creates an OriginException (which is an exception that includes the additional information about the origin). You should create your own exception classes which extend OriginException so you can then handle specific problems in your application/library.

Sanitize data and arguments

Dumping some form of debug data is a common requirement, but often is more troublesome than expected. When dumping data with objects in modern frameworks, the resulting dump can be so big that it exceeds the PHP memory limit and makes problems harder to spot rather than easier. Also, binary data in the dump can make it impossible to see anything useful.

Squirrel\Debug\Debug::sanitizeData and Squirrel\Debug\Debug::sanitizeArguments create small dumps without including object data: they only include the class name for objects, they show binary data as hex strings, and they show the resource type for resources. Arrays are shown in PHP array notation, so the output is easy to read for PHP developers. All other data types are shown fully (string, int, float, bool, null).

Squirrel\Debug\Debug::sanitizeArguments is used internally by Squirrel\Debug\Debug::createException to show the origin call that lead to an exception, which is why the functionality was added to this library.


All versions of debug with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
ext-mbstring Version *
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 squirrelphp/debug contains the following files

Loading the files please wait ....