PHP code example of justbetter / laravel-akeneo-client
1. Go to this page and download the library: Download justbetter/laravel-akeneo-client 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/ */
justbetter / laravel-akeneo-client example snippets
use JustBetter\AkeneoClient\Client\Akeneo;
public function __construct(Akeneo $akeneo)
{
$product = $akeneo->getProductApi()->get('1000');
}
use Illuminate\Support\Facades\Event;
use JustBetter\AkeneoClient\Events\ProductCreatedEvent;
Event::listen(function (ProductCreatedEvent $event): void {
//
});
use Illuminate\Support\Facades\Http;
use JustBetter\AkeneoClient\Client\Akeneo;
// This will fake Akeneo credentials and a sign in.
Akeneo::fake();
// Fake the specific call you will be using
Http::fake([
'akeneo/api/rest/v1/products/1000' => Http::response([
'identifier' => '1000',
'enabled' => true,
'family' => 'hydras',
'categories' => [],
'groups' => [],
'parent' => null,
'values' => [
'name' => [
[
'locale' => 'nl_NL',
'scope' => 'ecommerce',
'data' => 'Ziggy',
],
],
],
]),
]);
// Get the product with the fake response
$response = $akeneo->getProductApi()->get('1000');