Category Archives for laravel

My default laravel packages

I almost always install the following packages on a new laravel project.

What about you?

composer require \
    "lab404/laravel-impersonate" \
    "livewire/livewire" \
    "lorisleiva/laravel-actions" \
    "sentry/sentry" \
    "sentry/sentry-laravel" \
    "spatie/laravel-data" \
    "spatie/laravel-login-link" \
    "spatie/laravel-permission" \
    "spatie/laravel-ray" \
    "spatie/laravel-slack-alerts" 

And for development

composer require --dev \
    "barryvdh/laravel-debugbar" \
    "driftingly/rector-laravel" \
    "fakerphp/faker" \
    "larastan/larastan" \
    "laravel/pint" \
    "pestphp/pest" \
    "pestphp/pest-plugin-laravel" \
    "phpstan/phpstan" \
    "rector/rector" \
    "spatie/laravel-ignition" \
    "xammie/mailbook" 

Add pint to PHPStorm File Watchers

Open your settings in PHPStorm and go to Tools > File Watchers

Add a new Custom File Watcher and use the following information:

Name: pint
File type: PHP
Program: $ProjectFileDir$/vendor/bin/pint
Arguments: $FileRelativePath$
Output paths to refresh: $FileRelativePath$
Working directory: $ProjectFileDir$

Add url to your laravel Exception context

props to @_newtonjob https://twitter.com/_newtonjob/status/1724023158787694864/photo/1

<?php
// file app/Exceptions/Handler.php
class Handler extends ExceptionHandler
{
   
    public function register(): void
    {
       
       //
    }

    public function context()
    {
        return array_merge(parent::context(), [
            'url' => url()->full(),
            'method' => request()->getMethod(),
        ]);
    }
}