Skip to content
프로젝트

beyondcode/laravel-debugbar-companion

GitHub에서 보기

소개

The Laravel DebugBar companion app

웹 및 앱 개발

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
-1
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

Laravel DebugBar Companion

A Laravel DebugBar companion app that helps you debug your applications.

Installation

You can download the latest version of this application for MacOS, Windows, and Linux on the releases page.

The new socket storage driver is already available in the master branch of the Laravel Debugbar. If you don't want to use the master branch, you can already use this app in combination with this custom storage provider:

<?php
namespace App;

use DebugBar\Storage\StorageInterface;

class SocketStorage implements StorageInterface
{
    protected $socket;
    /**
     * @inheritDoc
     */
    function save($id, $data)
    {
        $socketIsFresh = !$this->socket;
        if (!$this->socket = $this->socket ?: $this->createSocket()) {
            return false;
        }
        $encodedPayload = json_encode([
            'id' => $id,
            'base_path' => base_path(),
            'app' => config('app.name'),
            'data' => $data,
        ]);
        $encodedPayload = strlen($encodedPayload).'#'.$encodedPayload;
        set_error_handler([self::class, 'nullErrorHandler']);
        try {
            if (-1 !== stream_socket_sendto($this->socket, $encodedPayload)) {
                return true;
            }
            if (!$socketIsFresh) {
                stream_socket_shutdown($this->socket, \STREAM_SHUT_RDWR);
                fclose($this->socket);
                $this->socket = $this->createSocket();
            }
            if (-1 !== stream_socket_sendto($this->socket, $encodedPayload)) {
                return true;
            }
        } finally {
            restore_error_handler();
        }
    }
    private static function nullErrorHandler($t, $m)
    {
        // no-op
    }
    protected function createSocket()
    {
        set_error_handler([self::class, 'nullErrorHandler']);
        try {
            return stream_socket_client('tcp://'.config('debugbar.storage.host', '127.0.0.1').':'.config('debugbar.storage.port', 2304));
        } finally {
            restore_error_handler();
        }
    }
    /**
     * @inheritDoc
     */
    function get($id)
    {
        //
    }
    /**
     * @inheritDoc
     */
    function find(array $filters = array(), $max = 20, $offset = 0)
    {
        //
    }
    /**
     * @inheritDoc
     */
    function clear()
    {
        //
    }
}

Just place it in you app directory and configure the debugbar in your config/debugbar.php file like this:

'storage' => [
    'enabled'    => true,
    'driver'     => 'custom', // redis, file, pdo, custom
    'provider'   => \App\SocketStorage::class, // Instance of StorageInterface for custom driver
],

Contributing

To get the application running locally, first install all required dependencies using yarn.

The application can be started in development mode using:

yarn electron:serve

This will start the application in a hot-reloading mode, so all changes will be immediately visible within the application.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

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

관련 프로젝트 살펴보기

불러오는 중…