Aliexpress Affiliate API
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
src/AliexIO add new field localCurrency Apr 17, 2016
tests Initial Commit Apr 2, 2016
.gitignore Initial Commit Apr 2, 2016
.travis.yml Initial Commit Apr 2, 2016 Initial Commit Apr 3, 2016
composer.json Initial Commit Apr 3, 2016
phpunit.xml Initial Commit Apr 2, 2016

#aliexapi Build Status Latest Stable Version Total Downloads

AliexApi is a PHP library for AliExpress Affiliate API program. You can use it to fetch product data. It interfaces with Aliexpress API functions such as listPromotionProduct, getPromotionProductDetail and getPromotionLinks. For more info on the API, visit To see a working demo site, goto cheap card phone.

This Library based on Jan Eichhorn's Amazon Product Advertising API.

AliExpress Affiliate Program

To signup and join the program, goto, you need to apply for API Key to get access.



Add the package 'clchangnet/aliexapi' to composer.json file:

    "require": {
        "clchangnet/aliexapi": "~1.0"

Update composer of the new package and download. Once done, you should see a folder 'clchangnet' under 'vendor' folder.

$ composer update
$ composer install

This will update the autoloader file and the library would be found once you include it in your code.

##Basic Usage:

Here is an example how to use Aliexpress API listPromotionProduct to search for products using keywords.

###Search Products

Note: To search by category. uncomment 'categoryId' and comment 'keywords' in searchItems and listPromotionProduct


namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Http\Requests;

use AliexApi\Configuration\GenericConfiguration;
use AliexApi\AliexIO;
use AliexApi\Operations\ListProducts;

class AliapiController extends Controller
    public function aliconfig($conf)
            return $conf;

    public function index()

    public function searchItems()
        $lppfields = [
            // 'categoryId' => '1501',
            'keywords' => 'baby shoes',
        $array = $this->listPromotionProduct($lppfields);

    public function listPromotionProduct($lppfields)
        $conf = new GenericConfiguration();
        $aliexIO = new AliexIO($conf);

        $listproducts = new ListProducts();
        // $listproducts->setCategoryId($lppfields['categoryId']);

        $formattedResponse = $aliexIO->runOperation($listproducts);
        $array = json_decode($formattedResponse, true);

        $array = array_merge($array, $lppfields);

        return $array;

###Get Affiliate Links

    public function getPromotionLinks()
        $conf = new GenericConfiguration();
        $aliexIO = new AliexIO($conf);

        $listproducts = new GetLinks();
        $listproducts->setUrls('http://url1, http://url2');

        $formattedResponse = $aliexIO->runOperation($listproducts);
        $array = json_decode($formattedResponse, true);
        return $array;

Example Workflow: Use ListProducts to search using keywords and set what fields to return. Use GetLinksTo convert product urls to your affiliate link.

##Webservice Documentation:

To find out about what fields can be return through API request, goto