2017 © Pedro Peláez
 

library laravel-fanout-provider

A simple and lightweight Laravel 4.2 and Laravel 5.* wrapper to interact with Fanout Service (fanout.io). Fanout is a SAAS that makes easy to build apps and APIs with realtime updates.

image

ricardofontanelli/laravel-fanout-provider

A simple and lightweight Laravel 4.2 and Laravel 5.* wrapper to interact with Fanout Service (fanout.io). Fanout is a SAAS that makes easy to build apps and APIs with realtime updates.

  • Sunday, February 4, 2018
  • by ricardofontanelli
  • Repository
  • 1 Watchers
  • 2 Stars
  • 10 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Laravel Fanout

A simple and lightweight Laravel 4.2 and Laravel 5.* wrapper to interact with Fanout Service (fanout.io). Fanout is a SAAS that makes easy to build apps and APIs with realtime updates., (*1)

Get Started:

  • First of all, you should create an account on Fanout website (fanout.io)[https://fanout.io] to obtain the service credentials (Realm ID and Realm Key);
  • Install the lib via composer;
  • Update the config file and be happy!

Installation

The Laravel Fanout Service Provider can be installed via ..., (*2)

composer require ricardofontanelli/laravel-fanout-provider:1.0 

or Composer by requiring the ricardofontanelli/laravel-fanout-provider package in your project's composer.json, (*3)

{
    "require": {
        "ricardofontanelli/laravel-fanout-provider": "1.0"
    }
}

Then run a composer update, (*4)

php composer update

To use the Laravel Fanout Service Provider, you must register the provider when bootstrapping your application., (*5)

In Laravel find the providers key in your config/app.php and register the Laravel Fanout Service Provider., (*6)

    // Laravel 4
    'providers' => array(
        // ...
        'RicardoFontanelli\LaravelFanout\FanoutServiceProvider',
    )

    // Laravel 5.*
    'providers' => [
        // ...
        RicardoFontanelli\LaravelFanout\FanoutServiceProvider::class,
    ]

Find the aliases key in your config/app.php and add the Laravel Fanout facade alias., (*7)

    // Laravel 4.*
    'aliases' => array(
        // ...
        'Fanout' => 'RicardoFontanelli\LaravelFanout\FanoutFacade',
    )

    // Laravel 5.*
    'aliases' => [
        // ...
        'Fanout' => RicardoFontanelli\LaravelFanout\FanoutFacade::class,
    ]

Publishing the package

Now, you should publish the package to generate the config file, after that, edit the config file with your Fanout credentials., (*8)

Laravel 4.2

The config file will be generate here: app/config/packages/ricardofontanelli/laravel-fanout-provider/config.php, (*9)

php artisan config:publish ricardofontanelli/laravel-fanout-provider

Laravel 5.*

The config file will be generate here: app/config/fanout.php, (*10)

php artisan vendor:publish --provider="RicardoFontanelli\LaravelFanout\FanoutServiceProvider"

Send a notification:

You have two options to test the front-end, the first is using the fanout Push Test Page, on Control Panel click the button "Push Test Page, on terminal open php artisan tinker and run:, (*11)

// Send a notification
Fanout::publish('test', 'My first realtime message using Fanout.io!!');

The second one is creating a file called fanout.html like that, pay attention to change the information about your realm id:, (*12)

<!DOCTYPE html>
<html>
    <head>
        <title>My Awesome Fanout + Laravel Example</title>
        <script src="http://{YOUR-REALM-ID}.fanoutcdn.com/bayeux/static/faye-browser-min.js"></script>
    </head>
    <body>
        <h2>My Awesome Fanout + Laravel Example</h2>
        <script>
            var client = new Faye.Client('http://{YOUR-REALM-ID}.fanoutcdn.com/bayeux');
                client.subscribe('my-channel', function (data) {
                alert('Got data: ' + data);
            });
        </script>
    </body>
</html>

Now, open the file fanout.html send your first message usign php artisan tinker and run:, (*13)

// Send a notification
Fanout::publish('my-channel', 'My first realtime message using Fanout.io!!');

You are free to change the channel name, fanout doesn't force you to create theses channels before send messages., (*14)

Find more:

This is a simples service provider to help you to quickly implements Fanout in your app, you can find more details about the Fanout PHP sdk on [https://github.com/fanout/php-fanout]. Have a look at Fanout (Docs)[https://fanout.io/docs/] to see how to implement the service in your frontend;, (*15)

The Versions

04/02 2018

dev-master

9999999-dev https://github.com/ricardofontanelli/laravel-fanout-provider

A simple and lightweight Laravel 4.2 and Laravel 5.* wrapper to interact with Fanout Service (fanout.io). Fanout is a SAAS that makes easy to build apps and APIs with realtime updates.

  Sources   Download

MIT BSD Style

The Requires

 

by Ricardo Fontanelli

laravel laravel 4 realtime messages laravel 5 websocket provider facade service provider fanout

16/02 2017

1.0

1.0.0.0 https://github.com/ricardofontanelli/laravel-fanout-provider

A simple and lightweight Laravel 4.2 and Laravel 5.* wrapper to interact with Fanout Service (fanout.io). Fanout is a SAAS that makes easy to build apps and APIs with realtime updates.

  Sources   Download

BSD Style

The Requires

 

by Ricardo Fontanelli

laravel laravel 4 realtime messages laravel 5 websocket provider facade service provider fanout