PHPackages                             patieru/gearman - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Queues &amp; Workers](/categories/queues)
4. /
5. patieru/gearman

ActiveLibrary[Queues &amp; Workers](/categories/queues)

patieru/gearman
===============

Gearman provider for queues in laravel 5.8 or laravel 6

v1.1.2(6y ago)061MITPHPPHP &gt;=7.2.0

Since Sep 8Pushed 6y ago1 watchersCompare

[ Source](https://github.com/patieru12/laravel-gearman)[ Packagist](https://packagist.org/packages/patieru/gearman)[ RSS](/packages/patieru-gearman/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (4)Dependencies (1)Versions (5)Used By (0)

Description
===========

[](#description)

This package gives you the possibily to add gearman as native queue back-end service

\#Installation

first you need to add it to your composer.json

```
"patieru/gearman": "^1.1"

```

second, in `config/app.php`, you need to comment out the native queue service provider

```
//Illuminate\Queue\QueueServiceProvider::class,

```

and to put this instead:

```
Patieru\Gearman\GearmanServiceProvider::class,

```

Then in your config/queue.php file you can add:

```
'default' => 'gearman',
'connections' => [
    ................
    'gearman' => [
        'driver' => 'gearman',
        'host'   => 'localhost', //means you gearman server is installed on you local machine
        'queue'  => 'default',
        'port'   => 4730,
        'timeout' => 1000 //milliseconds
    ],
]

```

or, if you have multiple gearman servers:

```
'connections' => [
    ...........................
    'gearman' => [
        'driver' => 'gearman',
        'hosts'  => [
            ['host' => 'localserver.local', 'port' => 4730],
            ['host' => 'localserver2.local', 'port' => 4730],
        ],
        'queue'  => 'default',
        'timeout' => 1000 //milliseconds
    ]
]

```

Then Remember to change default connection for Queue change from

```
QUEUE_CONNECTION=sync

```

to

```
QUEUE_CONNECTION=gearman

```

in .env

Then in your code you can add code as (this is the native way to add jobs to the queue):

```
Job::dispatch();

```

Small hint, you can call Namespaced classes and everything that is written in the docs of laravel for calling custom methods is valid here, too.

Example:
========

[](#example)

I add a "service" folder to my app folder and inside I create a file "SendMail.php" The code of the class is here:

```
