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.
Installs: 339 123
Dependents: 4
Suggesters: 0
Security: 0
Stars: 30
Watchers: 36
Forks: 16
Open Issues: 13
Requires
- php: >=8.1.0
- ext-curl: *
- guzzlehttp/guzzle: ~6.0 || ~7.0
- guzzlehttp/psr7: ~1.7 || ~2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.9
- php-parallel-lint/php-parallel-lint: ^1.3
- phpunit/phpunit: ~8.0
- squizlabs/php_codesniffer: ^3.10
This package is auto-updated.
Last update: 2024-10-15 15:31:36 UTC
README
This is the official Mirakl PHP API client for the shop
role.
How to install
composer require mirakl/sdk-php-shop
How to use
<?php require 'vendor/autoload.php'; use Mirakl\MMP\Shop\Client\ShopApiClient; use Mirakl\MMP\Shop\Request\Offer\GetOfferRequest; // Environment parameters $url = 'https://your.env/api'; $apiKey = 'your_api_key'; try { // Instantiating the Mirakl API Client $api = new ShopApiClient('API_URL', 'API_KEY', 'SHOP_ID'); // Building request $request = new GetOfferRequest('OFFER_ID'); // Calling the API $result = $api->getOffer($request); var_dump($result); // \Mirakl\MMP\Shop\Domain\Offer\ShopOffer // 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); }