PHP code example of mxl / laravel-queue-rate-limit

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

    

mxl / laravel-queue-rate-limit example snippets


'rateLimits' => [
     'mail' => [ // queue name
        'allows' => 1, // 1 job
        'every' => 5 // per 5 seconds
     ]
]

Mail::queue(..., 'mail');
Mail::queue(..., 'mail');
Mail::queue(..., 'mail');
Mail::queue(..., 'default');
Mail::queue(..., 'default');



namespace App\Providers;

class QueueServiceProvider extends \MichaelLedin\LaravelQueueRateLimit\QueueServiceProvider
{
    protected function registerLogger()
    {
        $this->app->singleton('queue.logger', function () {
            return null;
        });
    }
}



return [
    // ...
    'providers' => [
        // Laravel Framework Service Providers
        // ...
        // Application Service Providers
        // ...
        App\Providers\QueueServiceProvider::class,
        // ...
    ]
];