arnislielturks/faye-client

Faye Client Service provider for laravel

0.16 2017-04-27 11:36 UTC

This package is auto-updated.

Last update: 2024-11-06 10:08:25 UTC


README

This is a wrapper for awesome https://github.com/nchaulet/faye-client library. Intended for use in Laravel 5+ applications

Installation

  1. Install the package via composer:
composer require arnislielturks/faye-client
  1. Register the provider in config/app.php
// 'providers' => [
   ArnisLielturks\FayeClient\FayeServiceProvider::class,
// ];
  1. Add configuration file (config/faye.php) with the following content. This should point to the Faye service
return [
    'server' => 'http://127.0.0.1:8000',
    'token' => 'your-token-here'
];
  1. Initialize and use the Faye client
namespace App\Http\Controllers;

use Illuminate\Http\Request;
use ArnisLielturks\FayeClient\FayeServiceInterface;

class TestController extends Controller
{
    protected $faye;
    
    public function __construct(FayeServiceInterface $faye)
    {
        $this->faye = $faye;
    }

    public function sendFayeMessage()
    {
        $this->faye->send('/test', ['message'=>'test'], ['token' => '123']);
    }
}

That's it!