Package Data | |
---|---|
Maintainer Username: | lopadova |
Maintainer Contact: | helpdesk@padosoft.com (Lorenzo Padovani) |
Package Create Date: | 2016-11-14 |
Package Last Update: | 2023-09-28 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-11 15:00:54 |
Package Statistics | |
---|---|
Total Downloads: | 1,407 |
Monthly Downloads: | 1 |
Daily Downloads: | 0 |
Total Stars: | 75 |
Total Watchers: | 13 |
Total Forks: | 23 |
Total Open Issues: | 2 |
The goal of this Laravel package is to wrap the Publisher Network Affiliate API like Zanox, Tradedoubler, Commission Junction etc.. and provide simple methods to get deals and sales report and return a common interface for your use.
##Overview
Common methods are:
##Requires
You can install the package via composer:
$ composer require padosoft/laravel-affiliate-network
You must install this service provider.
// config/app.php
'provider' => [
...
Padosoft\AffiliateNetwork\AffiliateNetworkServiceProvider::class,
...
];
You don't need to register the command in app/Console/Kernel.php, because it provides by AffiliateNetworkServiceProvider register() method.
You can publish the config file of this package with this command:
php artisan vendor:publish --provider="Padosoft\AffiliateNetwork\AffiliateNetworkServiceProvider"
The following config file will be published in config/laravel-affiliate-network.php
return array(
'zanox' => array(
'username' => env(
'ZANOX_USERNAME',
'padosoft'
),
'password' => env(
'ZANOX_PASSWORD',
''
)
),
'tradedoubler' => array(
'username' => env(
'TRADEDOUBLER_USERNAME',
'padosoft'
),
'password' => env(
'TRADEDOUBLER_PASSWORD',
''
)
),
'commissionjunction' => array(
'username' => env(
'COMMISSIONJUNCTION_USERNAME',
'padosoft'
),
'password' => env(
'COMMISSIONJUNCTION_PASSWORD',
''
)
),
);
In your app config folder you can copy from src/config/.env.example the settings for yours .env file used in laravel-affiliate-network.php. If you use mathiasgrimm/laravel-env-validator in src/config folder you'll find an example for validate the env settings.
Create new php file, add composer autoload and start using functions.
<?php
require "vendor/autoload.php";
//if not in laravel need to define this functions
if (!function_exists('public_path')){
function public_path(){
return dirname(__FILE__);
}
}
$objNetworkManager= new NetworkManager();
$objNetworkManager->login('Zanox',$_ENV['ZANOX_USERNAME'], $_ENV['ZANOX_PASSWORD']);
$isLogged = $objNetworkManager->checkLogin('Zanox');
if ($isLogged){
echo '<h1>Deals</h1>';
$arrDeals = $objNetworkManager->getDeals('Zanox');
echo '<pre>';
var_dump($arrDeals);
echo '</pre>';
}
In Laravel:
$networkManager=app(NetworkManager::class);
$dateFrom=new DateTime();
$dateTo= new DateTime();
//if you want to specify specific Merchant:
$arrMerchantID = array(
array('cid' => '9716', 'name' => 'Zalando IT')
);
$networkManager->login('Zanox',$_ENV['ZANOX_USERNAME'], $_ENV['ZANOX_PASSWORD']);
$isLogged = $networkManager->checkLogin('Zanox');
if ($isLogged){
echo '<h1>Transactions</h1>';
$transactions = $networkManager->getSales('Zanox',$dateFrom,$dateTo,$arrMerchantID);
echo '<h1>Deals</h1>';
$arrDeals = $networkManager->getDeals('Zanox');
echo '<pre>';
var_dump($arrDeals);
echo '</pre>';
}
Please see CHANGELOG for more information what has changed recently.
$ composer test
Please see CONTRIBUTING for details.
If you discover any security related issues, please email instead of using the issue tracker.
Padosoft (https://www.padosoft.com) is a software house based in Florence, Italy. Specialized in E-commerce and web sites.
The MIT License (MIT). Please see License File for more information.