jreinke / mirakl-sdk-php-shop
Mirakl provides a PHP SDK that wraps the Mirakl REST APIs in a lightweight library. This enables you to develop a fast, flexible and custom integration for your existing e-commerce solution.
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 2 857
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=5.5.0
- ext-curl: *
- guzzlehttp/guzzle: ~6.0
Requires (Dev)
- jakub-onderka/php-console-highlighter: ^0.3.2
- jakub-onderka/php-parallel-lint: ^0.9.2
- phpunit/phpunit: ~5.0
This package is not auto-updated.
Last update: 2024-04-14 18:09:53 UTC
README
mirakl-sdk-php
is the official Mirakl PHP API client.
How to use
<?php /** * This example is for the role Frontend. For any other role there is another client. * For the role Shop the appropriate client is \Mirakl\MMP\Shop\Client\ShopApiClient */ require 'vendor/autoload.php'; use Mirakl\MMP\Front\Client\FrontApiClient as MiraklApiClient; use Mirakl\MMP\Front\Request\Offer\GetOfferRequest; // Environment parameters $url = 'https://your.env/api'; $apiKey = 'your_api_key'; try { // Building request $request = new GetOfferRequest('2000'); // Instantiating the Mirakl API Client $api = new MiraklApiClient($url, $apiKey); // Calling the API $result = $api->getOffer($request); var_dump($result); // decorated response // You can also retrieve raw response by using run() method of API client: $result = $api->run($request); // or $api->raw()->getOffer($request) var_dump($result); // returns \Psr\Http\Message\ResponseInterface } catch (\Exception $e) { // An exception is thrown if object requested is not found or if an error occurs var_dump($e); }