Constructing push - abraovic/phpush GitHub Wiki

#Constructor parameters

$type

Defines which type of notification is being used for current instance

There are two types:

  • IOS - PHPush::IOS
  • ANDROID - PHPush::ANDROID

$credential

Credentials for contacting notification server.

Credentials are different based on which type of service you need. But, both of service share one credential which is:

  • device_token - generated by the device

APNS

  • certificate_path - path to the .pem resource on your server
  • certificate_phrase - password for certificate (optional)
  • dev - true or false, if true sandbox will be use

be sure to use development certificate when dev is set true

GCM

  • google_api_key - just your Google API Key

IMPORTANT All data needs to be sent even if empty. All data is sent as an array. For example for APNS:

$credentials = array(

    'device_token' => 'your-token',

    'certificate_path' => '/path/to/your/cert.pem',

    'certificate_phrase' => '', // no password, but you need to set it as empty anyway

    'dev' => false
);