PHP code example of meplato / store2
1. Go to this page and download the library: Download meplato/store2 library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
meplato / store2 example snippets
// Client is responsible for performing HTTP requests.
// The API comes with a default (based on GuzzleHttp),
// but feel free to create your own.
$client = new \Meplato\Store2\HttpClient();
// Create and initialize the Catalogs service with your API token.
$service = new \Meplato\Store2\Catalogs\Service($client);
$service->setUser("<your-api-token>");
// Now get the catalogs and print them.
$response = $service->search()->skip(0)->take(0)->sort("-created,name")->execute();
echo "You have " . $response["totalItems"] . " catalogs.\n";
foreach ($response['items'] as $catalog) {
echo "Catalog " . $catalog["id"] . " has name " . $catalog["name"] . "\n";
}