New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

per3evere/preq

Microservices IPC command factory for Laravel && Lumen
3,149 7
Install
composer require per3evere/preq
Latest Version:v2.0.0
PHP:^7.1
Laravel:5 – 8
License:MIT
Last Updated:Mar 19, 2021
Links: GitHub  ·  Packagist
Maintainer: per3evere

Build Status

About Preq

Preq is a latency and fault tolerance library for Laravel && Lumen, inspired by Netflix’s Hystrix and upwork/phystrix

Installation

Require this package with composer:

composer require per3evere/preq --dev

Add ServiceProvider

Laravel

add this to the providers array in config/app.php

Per3evere\Preq\PreqServiceProvider::class

Lumen

add this in bootstrap/app.php

$app->register(Per3evere\Preq\PreqServiceProvider::class);

Usage

Create service command file

namespace App\Services;

use Per3evere\Preq\AbstractCommand;

class Example extends AbstractCommand
{
    /**
     * 同步执行命令.
     *
     * @return void
     */
    public function run()
    {
        return 'run!';
    }

    /**
     * 异步执行命令.
     *
     * @return \Guzzlehttp\Promise\Promise;
     */
    public function runAsync()
    {
        // 返回注意返回类型.
    }
}

execute it

$command = app('preq')->getCommand(\App\Services\Example::class);

// 同步执行命令
echo $command->execute();

// 异步执行命令
$command->queue();

Related Packages

chocofamilyme/laravel-smart-http

HTTP клинт Laravel для общения между сервисами

1,820 0
poweredlocal/vrata

API gateway written in PHP7 and Lumen

787 473
asseco-voice/laravel-blueprint-audit

Laravel support for additional blueprint methods

7,882 0
kipchak/driver-http

An HTTP Kipchak driver (dependency) for the Kipchak API Development Kit (ADK)

1,988

Version History

Version Released PHP Laravel License
v2.0.0 ^7.1 ^5.8|^6.0|^7.0|^8.0 MIT
v1.0.6 >=5.6.4 ~5.1 MIT
1.0.5 >=5.6.4 ~5.1 MIT
1.0.4 >=5.6.4 ~5.1 MIT
1.0.3 >=5.6.4 ~5.1 MIT