2017 © Pedro PelĂĄez
 

library magento-client

Magento API Client (SOAP v1). Allows wrappers for each call, dependency injections and code completion.

image

smalot/magento-client

Magento API Client (SOAP v1). Allows wrappers for each call, dependency injections and code completion.

  • Thursday, June 2, 2016
  • by smalot
  • Repository
  • 12 Watchers
  • 69 Stars
  • 37,703 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 24 Forks
  • 5 Open issues
  • 15 Versions
  • 10 % Grown

The README.md

Magento API Client

This library implements the Magento SOAP v1 (standard) API., (*1)

Scrutinizer Quality Score Total Downloads Current Version License, (*2)

Features:, (*3)

  • allows wrappers
  • allows dependencies injections
  • allows code completion
  • auto-updated via composer packaging (packagist.org)

Note: This library is not related to Magento Company., (*4)

Documentation

This API is designed on top of Magento SOAP API V1., (*5)

Supported modules are : - Mage_Catalog - Mage_CatalogInventory - Mage_Checkout - Mage_Customer - Mage_Directory - Mage_Sales - Enterprise_CustomerBalance - Enterprise_CustomerGiftCard - Mage_GiftMessage - Mage_Core - Store View, (*6)

Module's names has been standardized to be more clean : - Catalog - CatalogInventory - Cart - Customer - Directory - Order - CustomerBalance - GiftCard - GiftMessage - Core - Store, (*7)

Note : login and logout calls are made only if needed., (*8)

Installation

Download using composer:, (*9)

{
    "require": {
        "smalot/magento-client": "*"
    }
}

Now tell composer to download the bundle by running the command:, (*10)

``` bash $ php composer.phar update smalot/magento-client, (*11)


Composer will install the bundle to your project's `vendor/smalot` directory and `create`/`update` an autoload file. # License This library is provided under MIT license (since v0.5.0 release). See the complete license : LICENSE # Implementation Each `module manager`, which heritate from `MagentoModuleAbstract`, will generate an `action`. Actions can be either directly executed or added to a `queue`. If it is directly executed, it will generate a `single call`, if not, that's a `multi call`. ## Single Call Here is a sample code to load tree of categories of the `default` website in a single call. ```php <?php // Include composer's autoloader mecanism include 'vendor/autoload.php'; // Init config $path = 'http://domainname.tld/shop-folder/'; $apiUser = 'username'; $apiKey = 'xxxxxxxxxxxxxxxxxxx'; // Create remote adapter which wrap soapclient $adapter = new \Smalot\Magento\RemoteAdapter($path, $apiUser, $apiKey); // Call any module's class $categoryManager = new \Smalot\Magento\Catalog\Category($adapter); $tree = $categoryManager->getTree()->execute(); var_dump($tree);

Multi Call

Multi call is only available on Magento Soap v1., (*12)

That's why this library is built on top of Magento Soap v1., (*13)

This function allows to group multiple soap calls into only one http request, which can be a very great optimization practice., (*14)

It removes network latency and reduce magento bootstrap processes., (*15)

Tipically, it can be used to synchronize a whole product catalog into very few number of calls., (*16)

<?php

// Include composer's autoloader mecanism
include 'vendor/autoload.php';

// Init config
$path    = 'http://domainname.tld/shop-folder/';
$apiUser = 'username';
$apiKey  = 'xxxxxxxxxxxxxxxxxxx';

// Create remote adapter which wrap soapclient
$adapter  = new \Smalot\Magento\RemoteAdapter($path, $apiUser, $apiKey);

// Build the queue for multicall
$queue = new \Smalot\Magento\MultiCallQueue($adapter);

// Call any module's class
$productManager = new \Smalot\Magento\Catalog\Product($adapter);
$productManager->getInfo(10)->addToQueue($queue);
$productManager->getInfo(11)->addToQueue($queue);
$productManager->getInfo(12)->addToQueue($queue);

// Request in one multicall information of 3 products (#10, #11, #12)
$products = $queue->execute();

var_dump($products);

Callback support for multicall

<?php

// Include composer's autoloader mecanism
include 'vendor/autoload.php';

// Init config
$path    = 'http://domainname.tld/shop-folder/';
$apiUser = 'username';
$apiKey  = 'xxxxxxxxxxxxxxxxxxx';

// Create remote adapter which wrap soapclient
$adapter  = new \Smalot\Magento\RemoteAdapter($path, $apiUser, $apiKey);

// Build the queue for multicall
$queue = new \Smalot\Magento\MultiCallQueue($adapter);

// Local catalog adapter
$localAdapter = new LocalAdapter(....);

// Store categories
$categoryManager = new \Smalot\Magento\Catalog\Category($adapter);
$categoryManager->getTree()->addToQueue($queue, array($localAdapter, 'updateCategories'));

// Store products into local catalog
$productManager = new \Smalot\Magento\Catalog\Product($adapter);
$productManager->getInfo(10)->addToQueue($queue, array($localAdapter, 'updateProduct'));
$productManager->getInfo(11)->addToQueue($queue, array($localAdapter, 'updateProduct'));
$productManager->getInfo(12)->addToQueue($queue, array($localAdapter, 'updateProduct'));

// Update local catalog
$products = $queue->execute();

The Versions

02/06 2016

dev-master

9999999-dev

Magento API Client (SOAP v1). Allows wrappers for each call, dependency injections and code completion.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

02/06 2016

v0.5.7

0.5.7.0

Magento API Client (SOAP v1). Allows wrappers for each call, dependency injections and code completion.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

16/10 2015

v0.5.6

0.5.6.0

Magento API Client (SOAP v1). Allows wrappers for each call, dependency injections and code completion.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

16/10 2015

v0.5.5

0.5.5.0

Magento API Client (SOAP v1). Allows wrappers for each call, dependency injections and code completion.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

19/01 2015

v0.5.4

0.5.4.0

Magento API Client (SOAP v1). Allows wrappers for each call, dependency injections and code completion.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

02/05 2014

v0.5.3

0.5.3.0

Magento API Client (SOAP v1). Allows wrappers for each call, dependency injections and code completion.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

01/05 2014

v0.5.2

0.5.2.0

Magento API Client (SOAP v1). Allows wrappers for each call, dependency injections and code completion.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

25/04 2014

v0.5.1

0.5.1.0

Magento API Client (SOAP v1). Allows wrappers for each call, dependency injections and code completion.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

04/03 2014

v0.5.0

0.5.0.0

Magento API Client (SOAP v1). Allows wrappers for each call, dependency injections and code completion.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

18/11 2013

v0.4.0

0.4.0.0

Magento API Client (SOAP v1). Allow wrappers for each call, dependencies injections and code completion.

  Sources   Download

GPL-2.0

The Requires

  • php >=5.3.0

 

The Development Requires

30/10 2013

v0.3.0

0.3.0.0

Magento API Client (SOAP v2 - standard). Allow wrappers for each call, dependencies injections and code completion.

  Sources   Download

GPL-2.0

The Requires

  • php >=5.3.0

 

The Development Requires

29/10 2013

v0.2.0

0.2.0.0

Magento API Client (SOAP v2 - standard). Allow wrappers for each call, dependencies injections and code completion.

  Sources   Download

GPL-2.0

The Requires

  • php >=5.3.0

 

The Development Requires

26/10 2013

v0.1.2

0.1.2.0

Magento API Client (SOAP v2 - standard). Allow wrappers for each call, dependencies injections and code completion.

  Sources   Download

GPL-2.0

The Requires

  • php >=5.3.0

 

The Development Requires

25/10 2013

v0.1.1

0.1.1.0

Magento API Client (SOAP v2 - standard). Allow wrappers for each call, dependencies injections and code completion.

  Sources   Download

GPL-2.0

The Requires

  • php >=5.3.0

 

The Development Requires

25/10 2013

v0.1.0

0.1.0.0

Magento API Client (SOAP v2 - standard). Allow wrappers for each call, dependencies injections and code completion.

  Sources   Download

GPL-2.0

The Requires

  • php >=5.3.0

 

The Development Requires