1. Go to this page and download the library: Download davix/customs-domain 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 Davix\Customs\Tariff\CommodityResolver;
use Davix\Customs\Tariff\MeasuredProperty;
$resolver = new CommodityResolver($repository);
$resolution = $resolver->resolve('620140', [
MeasuredProperty::NET_WEIGHT => 1.5,
]);
$resolution->outcome;
$resolution->commodity;
$resolution->candidates;
$resolution->narrowedByMeasurement;
$resolution->candidatesBeforeNarrowing;
use Davix\Customs\Provider\Hmrc\HmrcClientOptions;
use Davix\Customs\Tariff\Jurisdiction;
$options = HmrcClientOptions::for(
Jurisdiction::NorthernIreland
);
if ($repository->jurisdiction() !== $provider->jurisdiction()) {
throw new RuntimeException(
'Tariff repository and provider use different jurisdictions.'
);
}
use Davix\Customs\Rule\DefaultRuleSet;
use Davix\Customs\Rule\EvaluationContext;
$pool = DefaultRuleSet::pool();
// Includes rules that need tariff measures/provider data:
// $pool = DefaultRuleSet::fullPool();
$evaluation = $pool->evaluate(
$productData,
new EvaluationContext(
evaluatedAt: new DateTimeImmutable(),
settings: $settings,
resolution: $resolution,
historic: $historicRecord,
detail: $commodityDetail,
certificates: $certificateIndex,
quotas: $quotaSet,
),
);
$evaluation->issueCodes();
$evaluation->highestSeverity();
$evaluation->hasBlocking();
public function prerequisites(): array
{
return [
InvalidCodeFormat::CODE,
];
}
use Davix\Customs\Scan\ProductScanner;
use Davix\Customs\Scan\ScanOptions;
$scanner = new ProductScanner(
rules: DefaultRuleSet::fullPool(),
resolver: $resolver,
provider: $provider,
settings: $settings,
options: new ScanOptions(),
);
foreach ($scanner->scan($products) as $result) {
// Persist, display or otherwise process the result.
}
$summary = $scanner->summary();
use Davix\Customs\Provider\Hmrc\HmrcClient;
use Davix\Customs\Provider\Hmrc\HmrcClientOptions;
$provider = new HmrcClient(
httpClient: $httpClient,
requestFactory: $requestFactory,
options: new HmrcClientOptions(),
cache: $cache,
logger: $logger,
);
$issue->messageKey();
$issue->context;
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.