Magento REST Api wrapper to use with Amp PHP framework.
Require this package using Composer:
composer require webgriffe/amp-magento
## Usage
ApiClient is the main class of this library: it contains methods that wrap Magento REST API.
<?php
use Amp\Artax\DefaultClient;
use Webgriffe\AmpMagento\ApiClient;
require_once __DIR__.'/vendor/autoload.php';
$client = new ApiClient(
new DefaultClient(),
[
'baseUrl' => 'http://magento.base.url',
'username' => 'magento-username',
'password' => 'magento-password'
]
);
$order = \Amp\Promise\wait($client->getOrder(1));
var_dump($order);
The folder InMemoryMagento contains a fake Magento server and client to be used for automated testing. Unit tests in tests/ApiClientTest.php show how to use InMemoryMagento.
To contribute simply fork this repository, do your changes and then propose a pull requests. You should run coding standards check and tests as well:
vendor/bin/phpcs --standard=PSR2 src
vendor/bin/phpunit
This library is under the MIT license. See the complete license in the LICENSE file.
Developed by Webgriffe®