The community forums are in BETA and closed to the public.

How to install php sdk lib

Hello, i know it's a problem of mine, but i don't know how to go on. I'm trying to install php lib but when i load my page it says :Fatal error: Class 'Pubnub' not found in /var/www/mywebsite/pubnub.php on line 8. ( at line 8 i have : $pubnub = new Pubnub( 'demo', 'demo' ); I had : 1) $ git clone ./pubnub-php - OK 2) copyed composer folder - OK 3) insert require_once('lib/autoloader.php'); /* path is ok */ - OK 4) Add pubnub package to your composer.json file: <----- Here i don't know what to do. - ?? 5) Run composer install from command line <-- terminal say : No command 'composer' found, did you mean: Command 'compose' - ?? thank you all

See this page for full docs:

  1. Check your PHP version php -v

Note if you have PHP version 5.3 or higher, you have the option of using Composer.

For example on my system, I have PHP 5.4.38 and I don't want to use composer.

I create a new directory myProject. Next I create a new file hello.php with the following text:


use Pubnub\Pubnub;

$pubnub = new Pubnub('demo', 'demo');

$publish_result = $pubnub->publish('demo','Hello PubNub!');

Next I clone the Pubnub PHP SDK. Then I copy the <pubnub-php>/composer/lib into my myProject directory. My directory structure looks like this:


Now I can run the file:

myProject$ php hello.php

And it displays the following output:

    [0] => 1
    [1] => Sent
    [2] => 14286211078724482

How I can integrate Pubnub PHP SDK V3.7 with with Codeigniter framework. Facing some exception using autoloader.

Login or Signup to post a comment