Download the PHP package macino/cli-dumper without Composer

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

CliDumper Documentation

Overview

CliDumper is a compact and flexible PHP library designed for efficiently dumping PHP data structures such as arrays, objects, and scalars into a readable and customizable format. It enhances log readability, especially in scenarios involving large and complex data, by eliminating excessive verbosity and emphasizing minimalism, color, and structure.

With features like customizable output and syntax highlighting for scalar types, CliDumper stands out as a developer-friendly tool for debugging, logging, and real-time output processing in CLI environments.


Why CliDumper?

Dealing with complex data logs can often lead to cluttered log files filled with var_dump, var_export, or print_r outputs. While these methods are useful, they can become cumbersome, especially when searching for specific values in lengthy or nested outputs.

CliDumper solves this by:


Key Features

  1. Compact Output: Generates concise dumps for even the most complex data structures.
  2. Customizable Formatter: Modify scalar type representations (e.g., color-coded outputs).
  3. Visual Highlights:
    • Color differentiation for types (e.g., null, string, numeric, boolean).
    • Options to organize nested elements for clarity.
  4. Efficient Debugging: Output can be directly printed to CLI or returned as a string for further processing.
  5. Truncation: Set limits for string length to keep outputs within manageable size.
  6. Optional Separators: Add separators in output for better log organization.

Installation

Using Composer

Install the library via Composer:


Usage

Here are the basic usage examples for the CliDumper class:

Initialization


Dump Debugging Data

The dump method outputs a message and variable data to the CLI. Customize the output with optional flags.

Parameters


Alias for Dump

The d method is an alias for the dump method.


Custom Formatting

You can define your own formatter callback to modify scalar type representations. Use the $formatter property to define a custom formatting function.

Example:


Inline Dump

Use inlineDump to output or retrieve a serialized version of a variable without the heading message.

Parameters:


Configuration Options

Public Properties

  1. $enabled:

    • Type: bool
    • Default: true
    • Enables or disables dumping.

    Example:

  2. $truncate:

    • Type: int
    • Default: 80
    • Limits the length of strings in the dump. Set 0 for no limit.

    Example:

  3. $maxDepth:

    • Type: int
    • Default: -1 (no limit)
    • Specifies the maximum depth for nested data structures. If set, the dumper will truncate any nesting deeper than the specified level.

    Example:

  4. $formatter:

    • Type: callable
    • Default: A simple formatter that outputs unaltered scalars.
    • Provides custom display formatting for different scalar types.

    Example:


Methods

dump

Outputs formatted data to the CLI with an optional message.

d

Alias for dump.

inlineDump

Returns a formatted string of the provided data or prints it directly.


Use Cases

  1. Debugging:
    • Quickly visualize complex data structures in developer-friendly formats.
    • Highlight and differentiate key elements in the output using colors.
  2. Logging:
    • Write cleaner, compact logs for later analysis.
  3. Real-time Data Processing:
    • Print readable information from live CLI applications.

Limitations


Conclusion

CliDumper is a lightweight solution for PHP developers looking to improve debugging experiences, enhance log readability, and cleanly process real-time data in CLI environments. With its color coding, formatting flexibility, and compact outputs, CliDumper simplifies viewing intricate data structures without sacrificing detail.


All versions of cli-dumper 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 macino/cli-dumper contains the following files

Loading the files please wait ...