ArnisLielturks / faye-client by ArnisLielturks

Faye Client Service provider for laravel
578
0
1
Package Data
Maintainer Username: ArnisLielturks
Maintainer Contact: arnis.lielturks@gmail.com (Arnis Lielturks)
Package Create Date: 2017-04-24
Package Last Update: 2017-04-27
Language: PHP
License: MIT
Last Refreshed: 2024-11-17 03:00:20
Package Statistics
Total Downloads: 578
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 1
Total Forks: 0
Total Open Issues: 0

faye-client

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!