padosoft/laravel-affiliate-network 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

padosoft/laravel-affiliate-network

Composer 安装命令:

composer require padosoft/laravel-affiliate-network

包简介

agnostic helpers to use as foundation in packages and other project

README 文档

README

Latest Version on Packagist Software License Build Status Quality Score Total Downloads SensioLabsInsight

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:

  • getDeals : get the network deals.
  • getSales : get the network sales.
  • getStats : get the network deals stats.
  • getMerchants : get the network merchants.
  • checkLogin : check if logged in network.
  • login : login in into network.
  • getTrackingParameter : get network tracking params.
  • loadAvailableNetworks : get all available network.
  • hasNetwork : check if network are available.
  • addNetwork : add a network class that implements Network interface.

##Requires

  • php: >=7.0.0
  • illuminate/support
  • padosoft/support

Installation

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.

Networks Supported

  • CommissionJunction
  • Effiliation
  • Netaffiliation
  • Publicideas.com
  • TradeDoubler
  • Zanox
  • WebGains

Usage

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>';
}

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email instead of using the issue tracker.

Credits

About Padosoft

Padosoft (https://www.padosoft.com) is a software house based in Florence, Italy. Specialized in E-commerce and web sites.

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 1.42k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 78
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 78
  • Watchers: 11
  • Forks: 25
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-11-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固