PHPackages                             laler/laler - 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. [Debugging &amp; Profiling](/categories/debugging)
4. /
5. laler/laler

ActiveLibrary[Debugging &amp; Profiling](/categories/debugging)

laler/laler
===========

Capture PHP dumps and route them to configurable channels. Works with or without Laravel.

v1.0.7(6mo ago)266MITPHPPHP ^8.0

Since Oct 16Pushed 6mo agoCompare

[ Source](https://github.com/programinglive/laler)[ Packagist](https://packagist.org/packages/laler/laler)[ RSS](/packages/laler-laler/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (10)Used By (0)

Laler
=====

[](#laler)

[![Latest Version](https://camo.githubusercontent.com/2047066aea2e52b7a42cc8e558c14b2cde704c4d7c5af82115f5472a8caaff1e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c616c65722f6c616c65722e7376673f6c6162656c3d7061636b6167697374)](https://packagist.org/packages/laler/laler)[![Total Downloads](https://camo.githubusercontent.com/282e2fd17ea73d57457d70c7d8992647a240194a1b2d9540668d04791ae1c442/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c616c65722f6c616c65722e737667)](https://packagist.org/packages/laler/laler/stats)[![PHP Version Support](https://camo.githubusercontent.com/454ab8aebead9d3f249932c80e244436e8e4847c8196a94c66e3a3b579f3b4bf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6c616c65722f6c616c65722e737667)](https://packagist.org/packages/laler/laler)[![License](https://camo.githubusercontent.com/6ba9bde663e5682b190020e0ce1563f414283bb0448454d92c7d6cd7378b155a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6c616c65722f6c616c65722e737667)](LICENSE)[![Commits: Commiter](https://camo.githubusercontent.com/59366f5c4dd2e8b9d592e825a24aab126c90a6e511d72b2061c0cec61682a46b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f6d6d6974732d636f6d6d69746572253230656e666f726365642d3762363166662e737667)](https://www.npmjs.com/package/@programinglive/commiter)

Capture PHP `VarDumper` output and redirect it to any channel you control. Works with or without Laravel.

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

[](#table-of-contents)

- [Quick Start](#quick-start)
- [Requirements](#requirements)
- [Installation](#installation)
- [Windows Desktop App](#windows-desktop-app)
- [Integration Guides](#integration-guides)
    - [Plain PHP](#plain-php)
    - [Laravel](#laravel)
- [Usage Examples](#usage-examples)
    - [Laravel Usage](#laravel-usage)
    - [Plain PHP Usage](#plain-php-usage)
    - [Desktop App Integration](#desktop-app-integration)
- [Testing](#testing)
- [Release Process](#release-process)
- [Contributing](#contributing)
- [License](#license)

Quick Start
-----------

[](#quick-start)

1. **Install the library:** `composer require laler/laler`
2. **Install Windows desktop app** (optional): Download and run `installer/lalerapp_0.1.0_x64_en-US.msi` as Administrator
3. **Start debugging:** Use `laler('Your debug data')` in your PHP code
4. **View results** in the desktop app or console

Requirements
------------

[](#requirements)

- PHP ^8.0
- Symfony VarDumper ^6.0 || ^7.0
- PSR-11 Container Interface ^1.0 || ^2.0

**Optional (for Laravel integration):**

- Laravel (Illuminate components) ^9.0 || ^12.0

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

[](#installation)

```
composer require laler/laler
composer install
```

**For Laravel projects:** The package is auto-discovered, so no manual provider registration is required.

To forward dumps to the desktop app during local development, add a `TauriDumper` registration inside your `App\Providers\AppServiceProvider` `boot()` method as shown below.

**For plain PHP projects:** Include the Composer autoloader and call the `laler()` helper.

Windows Desktop App
-------------------

[](#windows-desktop-app)

For a visual interface to view your laler() dumps, install the Windows desktop application:

### Installation

[](#installation-1)

1. **Download** the installer: `installer/lalerapp_0.1.0_x64_en-US.msi`
2. **Right-click** → **"Run as Administrator"** (required for system-level HTTP server setup)
3. **Follow** the installation wizard
4. **Launch** the Laler app from Start Menu or Desktop shortcut

### Usage

[](#usage)

1. **Start the desktop app** first
2. **Configure your laler() calls** to send dumps to the app (see TauriDumper examples below)
3. **View dumps** in real-time through the desktop interface

> **Note:** The desktop app provides a user-friendly interface for debugging and monitoring your PHP application dumps without cluttering your console or logs.

Integration Guides
------------------

[](#integration-guides)

### Plain PHP

[](#plain-php)

- **Boot autoloader:** `require 'vendor/autoload.php';`
- **Get manager:** `$manager = laler_manager();`
- **Register dumpers:** `$manager->register(new TauriDumper('http://localhost:3000'));`
- **Send values:** `laler($data);`

> **Note:** In plain PHP projects, the vendor directory is typically at your project root, so use `__DIR__ . '/vendor/autoload.php'`. In Laravel projects within subdirectories, you might need `__DIR__ . '/../vendor/autoload.php'` depending on your file location.

```
require __DIR__.'/vendor/autoload.php';

use DateTimeImmutable;
use Laler\Dumpers\TauriDumper;

if (! function_exists('now')) {
    function now(): DateTimeImmutable
    {
        return new class extends DateTimeImmutable {
            public function toISOString(): string
            {
                return $this->format(DATE_ATOM);
            }
        };
    }
}

$manager = laler_manager();
$manager->register(new TauriDumper('http://localhost:3000'));

laler(['data' => ['nested' => 'structure']]);
```

### Laravel

[](#laravel)

- **Install** `composer require laler/laler`
- **Register dumpers** (for example, in a service provider)

```
namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Laler\DumpCaptureManager;
use Laler\Dumpers\TauriDumper;

class AppServiceProvider extends ServiceProvider
{
    public function boot(): void
    {
        if ($this->app->environment('local')) {

            $manager = $this->app->make(DumpCaptureManager::class);
            $manager->register(new TauriDumper('http://localhost:3000'));
        }
    }
}
```

- **Use helper:** call `laler()` anywhere to route values through configured dumpers.

Usage Examples
--------------

[](#usage-examples)

### Laravel Usage

[](#laravel-usage)

`DumpCaptureManager` centralises dump collection and forwards each value to your registered dumpers. Retrieve it from the container and register any `DataDumperInterface` implementation:

```
use Laler\DumpCaptureManager;
use Laler\Dumpers\TauriDumper;

$manager = app(DumpCaptureManager::class);

if (app()->environment('local')) {
    $manager->register(new TauriDumper('http://localhost:3000'));
}

laler('Hello from Laler!'); // Routed to the Tauri desktop app
```

#### Capturing Database Queries

[](#capturing-database-queries)

Enable automatic forwarding of executed queries to your configured dumpers:

```
// Start listening for queries (typically in a tinker session or controller)
laler_show_queries();

User::firstWhere('email', 'john@example.com');

// Stop when you're done
laler_stop_showing_queries();
```

Each query is sent as an array with the SQL, bindings, execution time (ms), and connection name, so dumpers like the desktop app can display them clearly.

### Plain PHP Usage

[](#plain-php-usage)

For projects without Laravel, use the global helper functions. Here's the complete example from `examples/plain_php_usage.php`:

```
