2017 © Pedro Peláez
 

library magento-client-php

A PHP client library that consumes Magento's REST and XMLRPC APIs

image

cpliakas/magento-client-php

A PHP client library that consumes Magento's REST and XMLRPC APIs

  • Thursday, February 20, 2014
  • by cpliakas
  • Repository
  • 6 Watchers
  • 48 Stars
  • 7,001 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 18 Forks
  • 4 Open issues
  • 3 Versions
  • 21 % Grown

The README.md

Magento Client Library For PHP

Build Status Coverage Status Total Downloads Latest Stable Version, (*1)

Provides a client library to make REST and XMLRPC calls to a Magento instance., (*2)

Installation

Magento Client Library For PHP can be installed with Composer by adding it as a dependency to your project's composer.json file., (*3)

{
    "require": {
        "cpliakas/magento-client-php": "*"
    }
}

After running php composer.phar update on the command line, include the autoloader in your PHP scripts so that the SDK classes are made available., (*4)

require_once 'vendor/autoload.php';

Please refer to Composer's documentation for more detailed installation and usage instructions., (*5)

Usage

XMLRPC

The following example returns a list of products with SKUs that start with "123":, (*6)


use Magento\Client\Xmlrpc\MagentoXmlrpcClient; $client = MagentoXmlrpcClient::factory(array( 'base_url' => 'http://magentohost', 'api_user' => 'api.user', 'api_key' => 'some.private.key', )); $filters = array( 'sku' => array('like' => '123%'), ); $result = $client->call('catalog_product.list', array($filters));

Rest

The following example returns a list of products:, (*7)


use Magento\Client\Rest\MagentoRestClient; $client = MagentoRestClient::factory(array( 'base_url' => 'http://magentohost', 'consumer_key' => 'abc123...', 'consumer_secret' => 'def456...', 'token' => 'ghi789...', 'token_secret' => 'jkl012...', )); $result = $client->get('/api/rest/products')->send()->json();

Refer to Guzzle's documentation for more information on sending requests to the server., (*8)

The Versions