Download the PHP package patieru/gearman without Composer

On this page you can find all versions of the php package patieru/gearman. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package gearman

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:

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

<?php

namespace App\Jobs;

use App\AudioProcessor;
use App\Podcast;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;

class ProcessPodcast implements ShouldQueue {

    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
    protected $podcast;

    public function __construct(Podcast $podcast){
        $this->podcast = $podcast;
    }

    public function handle(AudioProcessor $processor){
        // Process uploaded podcast...
    }

}

In you controller

<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use App\Jobs\ProcessPodcast;
use Illuminate\Http\Request;

class PodcastController extends Controller {
    /**
    * Store a new podcast.
    *
    * @param  Request  $request
    * @return Response
    */
    public function store(Request $request)
    {
        // Create podcast...

        ProcessPodcast::dispatch($podcast);
    }
}

In my routes file I add a new Route

Route::post('/gearman', 'App\Http\Controllers\PodcastController@store');

Finally I just run on my console:

php artisan queue:listen

And I go to check what's on my email

Bugs

Please if you notice a bug open an issue or submit request.

Hope this package will help you


All versions of gearman with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2.0
illuminate/support Version >=5.8
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package patieru/gearman contains the following files

Loading the files please wait ....