Dump variable as JSON or dd()

dev-main 2022-05-13 13:26 UTC

This package is auto-updated.

Last update: 2025-06-13 20:04:30 UTC


README

Latest Version on Packagist Total Downloads

Installation

You can install the package via composer:

composer require pverhaert/dump

Usage

// controller
public function index()
{
    $users = User::all();
    Dump::var($users);
    return view('allusers', compact('users'));
}
// view
<h1>All users</h1>
<ul>
    @foreach($users as $user)
        <li>{{ $user->name }}: <a href="mailto:{{ $user->email }}">{{ $user->email }}</a></li>
    @endforeach
</ul>
  • http://testdomain.test/allusers : shows the regular view with all users
  • http://testdomain.test/allusers?json : shows the json representation of $users
  • http://testdomain.test/allusers?dd : dump and die the $users

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email patrick.verhaert@thomasmore.be instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.