1. Go to this page and download the library: Download daikazu/asi-smartlink 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/ */
use Daikazu\AsiSmartlink\Enums\AutoCompleteDimension;
use Daikazu\AsiSmartlink\Facades\AsiSmartlink;
use Daikazu\AsiSmartlink\Support\ProductQuery;
// 1. user types "bl" in the colour field — suggest matching values
$suggestions = AsiSmartlink::lists()->autoComplete(AutoCompleteDimension::Color, 'bl');
// ["Black Shades", "Blue Shades", "Bright Blue", ...]
// 2. user picks one — feed the exact value into the search filter
$results = AsiSmartlink::products()->search(
ProductQuery::make('shirt')->color('Blue Shades')
);
use Daikazu\AsiSmartlink\Exceptions\AuthenticationException;
use Daikazu\AsiSmartlink\Exceptions\ResourceNotFoundException;
use Daikazu\AsiSmartlink\Exceptions\RateLimitExceededException;
use Daikazu\AsiSmartlink\Exceptions\SmartLinkRequestException;
try {
$product = AsiSmartlink::products()->get(4815380);
} catch (ResourceNotFoundException $e) {
// 404 — {"Error":"Product not found"}
} catch (AuthenticationException $e) {
// 401/403 — bad or missing client_id / client_secret
} catch (RateLimitExceededException $e) {
// 429 — hourly limit (5,000) exceeded
$e->limit(); // 5000
$e->remaining(); // 0
$e->reset(); // X-Rate-Limit-Reset
} catch (SmartLinkRequestException $e) {
// any other API error (e.g. 5xx)
$e->getStatus(); // HTTP status code
$e->error(); // ASI "Error" message (null if the body wasn't JSON)
$e->getResponse(); // the underlying Saloon response
}