PHP code example of sagacorp / yii2-queue-azure-service-bus

1. Go to this page and download the library: Download sagacorp/yii2-queue-azure-service-bus 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/ */

    

sagacorp / yii2-queue-azure-service-bus example snippets


return [
    'components' => [
        'queue'                   => [
            'class'      => \saga\queue\azure\Queue::class,
            'as log'     => \yii\queue\LogBehavior,
            'serializer' => \yii\queue\serializers\JsonSerializer::class,
        ],
        'serviceBus'              => [
            'class'               => \saga\queue\azure\service\ServiceBus::class,
            'serviceBusNamespace' => 'your service bus namespace',
            'sharedAccessKey'     => 'your shared access key to access the service bus queue',
            'sharedAccessKeyName' => 'your shared access key name',
            'queue'               => 'the name of your Aruez Service Bus queue',
        ],
    ]
];
 

Yii::$app->queue->push(new DownloadJob([
    'url' => 'http://example.com/image.jpg',
    'file' => '/tmp/image.jpg',
]));