Pusher with FuelPHP

Pusher debug page
Pusher API Debug Page

Using Pusher with native PHP is relatively easy. But using it with a PHP Framework can be a little bit confusing, since it needs some additional work. Up to this date, there’s no Pusher PHP Library which is designed to work directly with FuelPHP. It just takes minutes to set up, though.

Setting Up Pusher

  1. Sign up for Pusher, if you haven’t got any account.
  2. Download the native PHP Pusher Library.
  3. Create a new directory “pusher” in your fuelPHP’s classes directory.
  4. Extract the file Pusher.php from the PHP Pusher Library arcive /lib to your pusher directory.
  5. Create a new file in your pusher directory: pusherinstance.php.
  6. Open the Pusher.php file. Cut the class PusherInstance to the file pusherinstance.php
  7. Close and rename the file Pusher.php into pusher.php (Note: it’s because UNIX system is case-sensitive, and fuelPHP assumes that your classes’ filename are all lowercased)
  8. Open the pusherinstance.php file. Enter your app credentials at the given attribute. See the Pusher API Access.

You’re done setting up Pusher. Now it’s for the real thing: test it out. You can use the existing example to quickly test your app.

  1. Go to the API Access page and take the Pastable HTML code, place it in your view.
  2. Go to Pusher PHP page. Use those examples at your controller, preferably different controller from the one controlling your view with JS from number 1.
  3. First, run the view with the JS (of course I mean, run it through a controller). Wait till it’s connected. You can see the console log in any “Inspect Element” menu of the browser.
  4. If it’s connected, then open a new browser tab, run your controller containing the example from the Pusher PHP. It should trigger the JS alert at your view with JS page.
  5. If the previous two steps is successful, congratulations, you are ready to use Pusher! See Pusher API Debug Page to monitor the connections.

Note: Just one mistake there at the Pusher PHP Presence example section: it’s not Pusher.auth_url. Instead, it should be Pusher.channel_auth_endpoint.

Good Luck!

1 thought on “Pusher with FuelPHP”

  1. My name is Eliot Estes. And I am a professional Content writer with many years of experience in writing.

    My primary goal is to solve problems related to writing. And I have been doing it for many years. I have been with several organizations as a volunteer and have assisted clients in many ways.
    My love for writing has no end. It is like the air we breathe, something I cherish with all my being. I am a full-time writer who started at an early age.
    I’m happy that I`ve already sold several copies of my poems in different countries like Canada and China and others too numerous to mention.
    I also work in an organization that provides assistance to many people from different parts of the world. Students always come to me because I work no matter how hard their projects are. I help them to save energy, because I feel fulfilled when people come to me for writing help.

    Academic Writer – Eliot Estes – Hesperialovesbooks Confederation

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.