PHP 8.3.31
Preview: PailServiceProvider.php Size: 2.37 KB
/home/getspomw/royalsquad.us/vendor/laravel/pail/src/PailServiceProvider.php

<?php

namespace Laravel\Pail;

use Illuminate\Console\Events\CommandStarting;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Log\Events\MessageLogged;
use Illuminate\Queue\Events\JobExceptionOccurred;
use Illuminate\Queue\Events\JobProcessed;
use Illuminate\Queue\Events\JobProcessing;
use Illuminate\Support\ServiceProvider;
use Laravel\Pail\Console\Commands\PailCommand;

class PailServiceProvider extends ServiceProvider
{
    /**
     * Registers the application services.
     */
    public function register(): void
    {
        $this->app->singleton(
            Files::class,
            fn (Application $app) => new Files($app->storagePath('pail'))
        );

        $this->app->singleton(Handler::class, fn (Application $app) => new Handler(
            $app,
            $app->make(Files::class), // @phpstan-ignore argument.type
            $app->runningInConsole(),
        ));
    }

    /**
     * Bootstraps the application services.
     */
    public function boot(): void
    {
        if (! $this->runningPailTests() && ($this->app->runningUnitTests() || ($_ENV['VAPOR_SSM_PATH'] ?? false))) {
            return;
        }

        /** @var \Illuminate\Contracts\Events\Dispatcher $events */
        $events = $this->app->make('events');

        $events->listen(MessageLogged::class, function (MessageLogged $messageLogged) {
            /** @var Handler $handler */
            $handler = $this->app->make(Handler::class);

            $handler->log($messageLogged);
        });

        $events->listen([CommandStarting::class, JobProcessing::class, JobExceptionOccurred::class], function (CommandStarting|JobProcessing|JobExceptionOccurred $lifecycleEvent) {
            /** @var Handler $handler */
            $handler = $this->app->make(Handler::class);

            $handler->setLastLifecycleEvent($lifecycleEvent);
        });

        $events->listen([JobProcessed::class], function () {
            /** @var Handler $handler */
            $handler = $this->app->make(Handler::class);

            $handler->setLastLifecycleEvent(null);
        });

        if ($this->app->runningInConsole()) {
            $this->commands([
                PailCommand::class,
            ]);
        }
    }

    /**
     * Determines if the Pail's test suite is running.
     */
    protected function runningPailTests(): bool
    {
        return $_ENV['PAIL_TESTS'] ?? false;
    }
}

Directory Contents

Dirs: 5 × Files: 8

Name Size Perms Modified Actions
Console DIR
- drwxrwxrwx 2025-09-17 06:53:03
Edit Download
Contracts DIR
- drwxrwxrwx 2025-09-17 06:53:03
Edit Download
Guards DIR
- drwxrwxrwx 2025-09-17 06:53:03
Edit Download
Printers DIR
- drwxrwxrwx 2026-04-21 18:27:07
Edit Download
- drwxrwxrwx 2025-09-17 06:53:03
Edit Download
960 B lrw-r--r-- 2026-04-25 12:17:06
Edit Download
1.86 KB lrw-rw-rw- 2025-09-17 06:53:03
Edit Download
540 B lrw-rw-rw- 2025-09-17 06:53:03
Edit Download
4.01 KB lrw-rw-rw- 2025-09-17 06:53:03
Edit Download
652 B lrw-rw-rw- 2025-09-17 06:53:03
Edit Download
2.05 KB lrw-rw-rw- 2025-09-17 06:53:03
Edit Download
2.37 KB lrw-rw-rw- 2025-09-17 06:53:03
Edit Download
1.84 KB lrw-rw-rw- 2025-09-17 06:53:03
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).