PHPackages                             salibhdr/php-dump-logger - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. salibhdr/php-dump-logger

ActivePackage[Logging &amp; Monitoring](/categories/logging)

salibhdr/php-dump-logger
========================

PHP dump logger uses Symfony's var-dumper to create a simple, easy to use, eye-friendly, and pretty log files for any PHP application. It can be used either standalone, with Laravel, Symfony, yii2, and other PHP frameworks

3.0.0(4mo ago)1040411MITPHPPHP ^7.2 | ^7.3 | ^7.4 | ^8.0 | ^8.1 | ^8.2 | ^8.3 | ^8.4CI passing

Since Jan 23Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/SaliBhdr/php-dump-logger)[ Packagist](https://packagist.org/packages/salibhdr/php-dump-logger)[ RSS](/packages/salibhdr-php-dump-logger/feed)WikiDiscussions main Synced today

READMEChangelog (7)Dependencies (4)Versions (8)Used By (1)

PHP Dump Logger
===============

[](#php-dump-logger)

It's All About Readability
--------------------------

[](#its-all-about-readability)

[![Total Downloads](https://camo.githubusercontent.com/ddd5a376d849a43c76858b9e0a4ef2effe960c20e0c0787e04cde8fa954906ca/68747470733a2f2f706f7365722e707567782e6f72672f73616c69626864722f7068702d64756d702d6c6f676765722f646f776e6c6f616473)](https://packagist.org/packages/salibhdr/php-dump-logger/stats)[![Today Downloads](https://camo.githubusercontent.com/43b3eeb7d7543d3d7e4afb90ca5636b29b9ae84ae788af4ebd7840dda10c1132/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64642f73616c69626864722f7068702d64756d702d6c6f676765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/salibhdr/php-dump-logger/stats)[![Required PHP Version](https://camo.githubusercontent.com/632cf299a648642bdc812c254855f5abd87e853f16916838e732d4a83ac6ba00/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d372e2a253743382e2a2d3838393262663f7374796c653d666c61742d737175617265266c6f676f3d706870)](https://packagist.org/packages/salibhdr/php-dump-logger)[![Testing](https://github.com/salibhdr/php-dump-logger/actions/workflows/testing.yml/badge.svg?branch=v2)](https://github.com/SaliBhdr/php-dump-logger/actions/workflows/testing.yml)[![codecov](https://camo.githubusercontent.com/29c22d45ded2d5eec75752a1fc8fc6dea8d11048f77a2140bf1520d396f91604/68747470733a2f2f636f6465636f762e696f2f67682f53616c69426864722f7068702d64756d702d6c6f676765722f6272616e63682f76322f67726170682f62616467652e7376673f746f6b656e3d5a47394e56364a525250)](https://codecov.io/gh/SaliBhdr/php-dump-logger)[![Latest Versions](https://camo.githubusercontent.com/c78a611de646df97298e2938a561dc5e396487fd8e31c1d4a738e27e3623a3b6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73616c69626864722f7068702d64756d702d6c6f676765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/salibhdr/php-dump-logger)[![Unstable Version](https://camo.githubusercontent.com/39ba4f6e50e1c362ebd24a47e88928162dff793e33ded8628bd2a03b6116ce1d/68747470733a2f2f706f7365722e707567782e6f72672f73616c69626864722f7068702d64756d702d6c6f676765722f762f756e737461626c65)](https://packagist.org/packages/salibhdr/php-dump-logger)

Table of Contents
-----------------

[](#table-of-contents)

- [Introduction](#introduction)
- [Installation](#installation)
- [Version Compatibility](#version-compatibility)
- [Basic Usage](#basic-usage)
- [Detailed Usage](#detailed-usage)
    - [Methods](#methods)
    - [Exception Logging](#exception-logging)
    - [Custom Log Level](#custom-log-level)
    - [Path](#path)
    - [Directory Name](#directory-name)
    - [Directory Permission](#directory-permission)
    - [Daily Log](#daily-log)
    - [Silent Logging](#silent-logging)
- [Loggers](#loggers)
    - [Pretty Logger](#pretty-logger)
    - [Html Logger](#html-logger)
    - [Raw Logger](#raw-logger)
    - [Custom Logger](#custom-logger)
- [Full Example](#full-example)
- [Issues](#issues)
- [License](#license)
- [Testing](#testing)
- [Contributing](#contributing)

Introduction
-------------

[](#introduction-)

PHP dump logger uses [Symfony's var-dumper](https://symfony.com/doc/current/components/var_dumper.html) to create a simple, easy to use, eye-friendly, and pretty log files for any PHP application. If you are a big fan of using `dd()` and `dump()`, this package is for you.

**Example log file content:**

[![php dump logger](https://camo.githubusercontent.com/726110fe3a86c6fe8722746603159ac98ad86954cd9662cde68c61fd4a08624e/68747470733a2f2f73796d666f6e792e636f6d2f646f632f362e322f5f696d616765732f30312d73696d706c652e706e67)](https://camo.githubusercontent.com/726110fe3a86c6fe8722746603159ac98ad86954cd9662cde68c61fd4a08624e/68747470733a2f2f73796d666f6e792e636f6d2f646f632f362e322f5f696d616765732f30312d73696d706c652e706e67)

Have you ever tried to log something with monolog, Symfony, or Laravel logger and tried to find the logged data inside a maze of text? Especially when you don't have time and don't want to go through installing and configuring Xdebug or there is a bug in production code, and you just want to see the API responses without messing with the code execution.

The problem with `dd()`, `dump()`, or `var_dump()` functions is that they print the data, which is something that sometimes you don't want, especially when the code execution should not be interrupted.

The first solution that comes to mind is to use a logger to log the data instead of using those print functions. But as I said, loggers aren't producing readable files, and sometimes you have to only provide them with a string, and they are incapable of directly logging a complex class. How nice would it be to have a functionality like `dd()` without interruption in the code?

Here **php-dump-logger** comes to the rescue.

**php-dump-logger** uses [Symfony's var-dumper](https://symfony.com/doc/current/components/var_dumper.html) to generate the log content and then saves the output into a file. Which is by the way really pleasant in the eye. You can either log the data in a nice `html` or `log` format or even provide your own dumper.

**Features**

- Readable log in `html` format
- Readable log in `log` format
- Ability to log classes, arrays, objects, and basically any variable you like. There is no limit.
- Fully customization of log format and dumper
- Separation of the daily and all in one logs
- Logging file in a custom level
- Changing the path and directory of the log

Installation
-------------

[](#installation-)

Install via composer:

```
 composer require salibhdr/php-dump-logger
```

Version Compatibility
----------------------

[](#version-compatibility-)

PHPPHP Dump Logger7.0.x to 7.1.x1.x7.2.x to 8.2.x2.xBasic Usage
------------

[](#basic-usage-)

```
