furqat/laravel-console-log

This package allows backend developers to effortlessly output messages and values in the terminal, serving as the PHP equivalent of console log for Laravel.

0.5 2024-09-02 15:53 UTC

This package is auto-updated.

Last update: 2024-11-02 16:24:17 UTC


README

Code Example Code Example

Laravel Console Log

This package allows backend developers to effortlessly output messages and values in the browser's console via PHP.

Latest Version on Packagist Total Downloads

Installation

You can install the package via composer:

composer require furqat/laravel-console-log

Usage

class HomeController extends Controller
{
    public function index()
    {

        $users = User::all();
        
        //it will show the count of users in the console of browser
        console()->info('The count of users is: ' . $users->count());

        return view('users', compact($users));
    }
}

How It Works

When you call console()->log(...$args) in your Laravel application, the package stores the logged messages and values in the cache. This allows the logs to be easily accessed and managed without cluttering the terminal or log files.

To view these logs, simply open any view in your browser. The package streams the cached logs to the frontend in real-time and show logs in browser's console using console.log(), providing a clear and organized view of all your log entries. This makes it easy for developers to monitor and debug their applications without interrupting their workflow.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

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