PHP code example of marmanik / laravel-azure-storage-queue

1. Go to this page and download the library: Download marmanik/laravel-azure-storage-queue 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/ */

    

marmanik / laravel-azure-storage-queue example snippets


// config/queue.php
'connections' => [

    'azure' => [
        'driver'       => 'azure-storage-queue',
        'account_name' => env('AZURE_STORAGE_ACCOUNT_NAME'),
        'account_key'  => env('AZURE_STORAGE_ACCOUNT_KEY'),
        'endpoint'     => env('AZURE_STORAGE_QUEUE_ENDPOINT'), // optional — see Azurite section
        'queue'        => env('AZURE_QUEUE_NAME', 'default'),
        'timeout'      => env('AZURE_QUEUE_TIMEOUT', 60),      // visibility timeout in seconds
    ],

],

'default' => env('QUEUE_CONNECTION', 'azure'),

dispatch(new App\Jobs\SendWelcomeEmail($user));

// Delay
dispatch(new App\Jobs\SendWelcomeEmail($user))->delay(now()->addMinutes(5));

// Specific queue
dispatch(new App\Jobs\SendWelcomeEmail($user))->onQueue('emails');

'environments' => [
    'production' => [
        'supervisor-azure' => [
            'connection' => 'azure',
            'queue'      => ['default'],
            'balance'    => 'simple',
            'processes'  => 10,
            'tries'      => 3,
        ],
    ],
],

Queue::connection('azure')->pushRaw($payload, 'default', ['ttl' => 3600]);
bash
php artisan queue:work azure
php artisan queue:work azure --queue=emails
bash
php artisan azure-storage-queue:create-queue