Use the OneSignal PHP API made by Norkunas.
$ composer require samiaraboglu/one-signal-api-bundle
Registered bundles in the app/AppKernel.php
file of your project:
<?php
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
// ...
new Samiax\OneSignalApiBundle\SamiaxOneSignalApiBundle(),
);
// ...
}
// ...
}
Add this to config.yml:
samiax_one_signal_api:
app_id: "{ONE_SIGNAL_API_APP_ID}"
app_auth_key: "{ONE_SIGNAL_API_APP_AUTH_KEY}"
user_auth_key: "{ONE_SIGNAL_API_USER_AUTH_KEY}"
Gets all apps:
$service = $this->get('samiax_one_signal_api.service');
$myApps = $service->apps->getAll();