2017 © Pedro PelĂĄez
 

library laravel-appsflyer

Laravel 5.6 integration for the Jlorente Appsflyer package.

image

jlorente/laravel-appsflyer

Laravel 5.6 integration for the Jlorente Appsflyer package.

  • Tuesday, May 29, 2018
  • by jlorente
  • Repository
  • 1 Watchers
  • 0 Stars
  • 58 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 867 % Grown

The README.md

Appsflyer SDK for Laravel

This extension allows you to access the Appsflyer API by a comprehensive way., (*1)

Installation

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)

Configuration

  1. Register the ServiceProvider in your config/app.php service provider list.

config/app.php, (*6)

return [
    //other stuff
    'providers' => [
        //other stuff
        \Jlorente\Laravel\Appsflyer\AppsflyerServiceProvider::class,
    ];
];
  1. Add the following facade to the $aliases section.

config/app.php, (*7)

return [
    //other stuff
    'aliases' => [
        //other stuff
        'Appsflyer' => \Jlorente\Laravel\Appsflyer\Facades\Appsflyer::class,
    ];
];
  1. Set the dev_key and api_token in the config/services.php in a new created appsflyer array.

config/services.php, (*8)

return [
    //other stuff
    'appsflyer' => [
        'dev_key' => 'YOUR_DEV_KEY',
        'api_token' => 'YOUR_API_TOKEN',
        'is_active' => true,
    ];
];

Usage

You can use the facade alias Appsflyer to execute api calls. The authentication params will be automaticaly injected., (*9)

Appsflyer::inappevent()->create($data);

Notification Channel

A notification channel is included in this package and allows you to integrate the Appsflyer in app events service with the Laravel notifications., (*10)

Formatting Notifications

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)

License

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)

The Versions

29/05 2018

dev-master

9999999-dev

Laravel 5.6 integration for the Jlorente Appsflyer package.

  Sources   Download

BSD-3-Clause

The Requires

 

by Jose Lorente

laravel php appsflyer jlorente