ghostwalker/jobber

Powerful, simple, message queue client

Fund package maintenance!
overtrue

dev-master 2022-08-30 13:12 UTC

This package is auto-updated.

Last update: 2024-03-29 04:46:43 UTC


README

68747470733a2f2f692e696d6775722e636f6d2f7469576836714c2e706e67

Welcome to Jobber 👋

Version License: MIT

Powerful, simple, message queue client

Install

composer require ghostwalker/jobber

Usage

Create bootServer.php file in your main directory You can also specify the address and port for the server and client, as well as specify the directory where your classes are stored

<?php
/**
 * boot JobberServer Class
 */
use GhostWalker\Jobber\JobberServer;

require_once __DIR__ . 'vendor/autoload.php';

JobberServer::$directory = __DIR__ . '/jobs';
JobberServer::$ipPort = '127.0.0.1:6969';
JobberServer::bootSystem();

Start server

php bootServer.php //To keep the process running permanently in the background,
you should use a process monitor such as Supervisor to ensure that the queue worker does not stop running.

create a class in the directory you specified and create a "__construct" method

with arguments that accepts an array of $date

<?php

class test {
    
    protected array $data = [];
    
    public function __construct(array $data)
    {
       $this->data = $data //array(int(999))
    }
}

Create a client class and load a new task

<?php

use \GhostWalker\Jobber\JobberClient;

require __DIR__ . '/vendor/autoload.php';

JobberClient::$ipPort = '127.0.0.1:6969';
$jobber = new JobberClient();
$jobber->addTask(test::class, [999]);
$jobber->addTask(test1::class, [123]);

Author

👤 GhostWalker

🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Work on

the application is based on ReactPhp, as well as a robot-loader for loading classes

Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2022 GhostWalker.
This project is MIT licensed.

❤️ readme