dev-master
9999999-devLaravel 5.6 integration for the Jlorente Appsflyer package.
BSD-3-Clause
The Requires
by Jose Lorente
laravel php appsflyer jlorente
Wallogit.com
2017 © Pedro PelĂĄez
Laravel 5.6 integration for the Jlorente Appsflyer package.
This extension allows you to access the Appsflyer API by a comprehensive way., (*1)
The preferred way to install this extension is through composer., (*2)
With Composer installed, you can then install the extension using the following commands:, (*3)
$ php composer.phar require jlorente/laravel-appsflyer
or add, (*4)
...
"require": {
"jlorente/laravel-appsflyer": "*"
}
to the require section of your composer.json file., (*5)
config/app.php, (*6)
return [
//other stuff
'providers' => [
//other stuff
\Jlorente\Laravel\Appsflyer\AppsflyerServiceProvider::class,
];
];
config/app.php, (*7)
return [
//other stuff
'aliases' => [
//other stuff
'Appsflyer' => \Jlorente\Laravel\Appsflyer\Facades\Appsflyer::class,
];
];
config/services.php, (*8)
return [
//other stuff
'appsflyer' => [
'dev_key' => 'YOUR_DEV_KEY',
'api_token' => 'YOUR_API_TOKEN',
'is_active' => true,
];
];
You can use the facade alias Appsflyer to execute api calls. The authentication params will be automaticaly injected., (*9)
Appsflyer::inappevent()->create($data);
A notification channel is included in this package and allows you to integrate the Appsflyer in app events service with the Laravel notifications., (*10)
If a notification should trigger an Appsflyer in app event, you should define a toAppsflyer method on the notification class. This method will receive a $notifiable entity and should return a Jlorente\Laravel\Appsflyer\Notifications\Messages\AppsflyerMessage instance:, (*11)
/**
* Get the AppsflyerMessage that represents the notification.
*
* @param mixed $notifiable
* @return \Jlorente\Laravel\Appsflyer\Notifications\Messages\AppsflyerMessage|string
*/
public function toAppsflyer($notifiable)
{
return (new AppsflyerMessage)
->platform('com.mycompany.myapp')
->payload([
'eventName' => 'af_purchase'
]);
}
Once done, you must add the notification channel in the array of the via() method of the notification:, (*12)
/**
* Get the notification channels.
*
* @param mixed $notifiable
* @return array|string
*/
public function via($notifiable)
{
return [AppsflyerChannel::class];
}
You can find more info about Laravel notifications in this page., (*13)
Copyright © 2018 JosĂ© Lorente MartĂn jose.lorente.martin@gmail.com., (*14)
Licensed under the BSD 3-Clause License. See LICENSE.txt for details., (*15)
Laravel 5.6 integration for the Jlorente Appsflyer package.
BSD-3-Clause
laravel php appsflyer jlorente