jmrieger / onesignal-laravel

OneSignal API wrapper for Laravel / Lumen.
MIT License
25 stars 9 forks source link

postApp function Example? #6

Closed LtotheWT closed 7 years ago

LtotheWT commented 7 years ago

Would you give an example of postApp($data) ??

jmrieger commented 7 years ago

I haven't tested this code, but the basic format should be:

$response = OneSignal::postApp([
    "name" => "Your App Name",  // This is the only required line
    "apns_env" => "sandbox",        // Optional Settings
    "gcm_key" => "wasdf1234"      // Optional Settings
]);

var_dump( json_decode( $response->getBody()->getContents(), true)  );

Note that, per the OneSignal Documentation, you MUST have your REST API key and User Auth key set - see the README on how to store those in your .env file.