PHP code example of nikolaynesov / laravel-command-streaming

1. Go to this page and download the library: Download nikolaynesov/laravel-command-streaming library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nikolaynesov / laravel-command-streaming example snippets


// config/command-streaming.php
return [
    'enabled' => env('COMMAND_STREAMING_ENABLED', false),
    'disk' => env('COMMAND_STREAMING_DISK', 'local'),
    'path_prefix' => 'command-logs',
];

use Illuminate\Console\Command;
use Nikolaynesov\CommandStreaming\Traits\StreamsCommandOutput;

class MyCommand extends Command
{
    use StreamsCommandOutput;

    protected $signature = 'my:command';

    public function handle(): int
    {
        $this->startStreaming();

        $this->info('This output will be streamed!');
        $this->line('Processing...');
        $this->error('Any errors are captured too');

        $this->stopStreaming();
        return 0;
    }
}

// config/filesystems.php
'command-logs' => [
    'driver' => 's3',
    'key' => env('AWS_ACCESS_KEY_ID'),
    'secret' => env('AWS_SECRET_ACCESS_KEY'),
    'region' => env('AWS_DEFAULT_REGION'),
    'bucket' => env('AWS_COMMAND_LOGS_BUCKET'),
],
bash
php artisan vendor:publish --tag=command-streaming-config