Skip to content

hobby10/laravel-devtools

 
 

Repository files navigation

LaravelDevTools

devtools preview

Features

  • Error Logger (with whoops or ignition preview)
  • Commands panel
  • DB Schema panel, MySql or SQLite
  • Cache panel, flush cache tags and cache keys
  • Mail catcher
  • Impersonate; Login as another user
  • Installed packages list

Installation

$ composer require alireza-h/laravel-devtools

Migration

Migrate tables

$ php artisan migrate

Publish

Publish configs

$ php artisan vendor:publish --tag="devtools.config"

Publish assets

$ php artisan vendor:publish --tag="devtools.assets"

Publish views to customize

$ php artisan vendor:publish --tag="devtools.views"

Custom Log Channel

Add devtools custom log channel to logging.php config file and use it

'devtools' => [
    'driver' => 'custom',
    'via' => \AlirezaH\LaravelDevTools\Lib\Monolog\MonologLogger::class,
]

...

'channels' => [
    'stack' => [
        'driver' => 'stack',
        'channels' => ['single', 'devtools'],
        'ignore_exceptions' => false,
    ],
    
    ...
]

Configuration

  • route_prefix devtools panel base url
  • users list of devtools panel credentials; username as key and password as value
  • custom_menu custom menu items for devtools panel
  • Error Logger
  • Mail Catcher

Error Logger

'error_logger' => [
    'enabled' => true,
    'engine' => 'db', // db | redis,
    'preview' => env('DEVTOOLS_ERROR_LOGGER_PREVIEW', 'ignition'), // whoops | ignition,
    'error_count_to_notify' => [10, 100, 1000, 10000],
    'clear_older_than' => 3600 * 72,
    'types' => [
        'warning' => [
            'log_to_slack' => false,
            'exceptions' => [
                ClientException::class,
                LaravelValidationException::class,
                MaintenanceModeException::class,
                TokenMismatchException::class,
                HttpException::class,
                MethodNotAllowedHttpException::class,
                AuthenticationException::class,
            ]
        ],
        'not_found' => [
            'log_to_slack' => false,
            'exceptions' => [
                ModelNotFoundException::class,
                NotFoundHttpException::class,
            ]
        ],
    ],
    'dont_log' => [ // don't log list of these exception types
        AuthenticationException::class,
        AuthorizationException::class,
        HttpException::class,
        HttpResponseException::class,
        ModelNotFoundException::class,
        SuspiciousOperationException::class,
        TokenMismatchException::class,
        ValidationException::class,
    ]
],
  • enabled enable or disable devtools error logger
  • engine store logs in redis or in db
  • preview preview errors and stack trace by whoops or ignition
  • error_count_to_notify error count boundaries to notify error in slack
  • clear_older_than clear error logs older than this value (in seconds)
  • types categorize error logs and define each type exceptions
    • log_to_slack enable or disable log to slack; you need to configure logging slack channel (LOG_SLACK_WEBHOOK_URL in logging.php config file)
    • exceptions list of exception classes
  • dont_log don't log list of defined exception types

Mail Catcher

'mail_catcher' => [
    'enabled' => true,
    'envs' => [
        'local',
        'demo',
        //'testing',
        //'production',
    ],
],
  • enabled enable or disable mail catcher
  • envs application environments to catch mails

Dev Tools Panel

Navigate to https://localhost:8000/dev-tools

Create your own password (https://localhost:8000/dev-tools/password), add it to devtools.php config file:

'users' => [
    'your_username' => 'your_hashed_password',
],

and use this credential for devtools panel

About

Laravel Dev Tools

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 69.7%
  • Blade 30.3%