SelectUpgrading PHP V3 to V4

These docs are for version 3.8.3 of the PHP SDK. To check out the docs for the latest version Click Here.

PubNub 4.0 for PHP is our latest and greatest! Please click here for our PubNub 4.0 for PHP docs and SDK.

PubNub 3.x for PHP will encounter End Of Life (EOL) Aug 1st, 2018. All users currently on 3.x should begin migrating to 4.x. The 3.x SDK will continue to work. We will no longer support it and if you run into an issue, we will request that you upgrade to the latest version before solving the issue.

If you have questions about the PubNub for PHP SDK, please contact us at

  • V3 exposes Pubnub
  • V4 exposes PubNub
 Always set the UUID to uniquely identify the user or device that connects to PubNub. This UUID should be persisted, and should remain unchanged for the lifetime of the user or the device. Not setting the UUID can significantly impact your billing if your account uses the Monthly Active Users (MAUs) based pricing model, and can also lead to unexpected behavior if you have Presence enabled.
  • V3 initiates via:
    use Pubnub\Pubnub;
    $pubnub = new Pubnub("my_pub_key", "my_sub_key", "my_secret_key", "my_cipher_key", true);
  • V4 initiates via:
    use PubNub\PNConfiguration;
    use PubNub\PubNub;
    $pnconf = new PNConfiguration();
    $pubnub = new PubNub($pnconf);
  • V3:
    $pubnub->publish('my_channel', "Hello World!");
  • V4:
        ->message("Hello World!")
  • V3 exposes only message subscribe callback via method params.
  • V4 exposes the functionality via listeners.
  • V4 returns a status object for each transactional request in the envelope and in the status portion of a listener or a callback.