PHP code example of artisan-build / assay-contracts
1. Go to this page and download the library: Download artisan-build/assay-contracts 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/ */
artisan-build / assay-contracts example snippets
use ArtisanBuild\AssayContracts\CaptureMode;
use ArtisanBuild\AssayContracts\Client;
use ArtisanBuild\AssayContracts\EnvelopeCodec;
use ArtisanBuild\AssayContracts\EnvelopeV1;
use ArtisanBuild\AssayContracts\Operation;
use ArtisanBuild\AssayContracts\RecordType;
use ArtisanBuild\AssayContracts\RecordV1;
use ArtisanBuild\AssayContracts\Source;
use ArtisanBuild\AssayContracts\Timestamp;
use ArtisanBuild\AssayContracts\UuidV7;
$envelope = new EnvelopeV1(
envelopeId: UuidV7::generate(),
sentAt: new Timestamp('2026-09-30T12:00:00.000000Z'),
client: new Client('artisan-build/assay-client', '1.0.0'),
sources: [new Source('laravel-ai', 'laravel/ai', '1.0.0')],
environment: 'production',
droppedTransportTotal: 0,
droppedHookTotal: 0,
records: [
new RecordV1(
recordId: UuidV7::generate(),
source: 'laravel-ai',
type: RecordType::RunStart,
operation: Operation::Agent,
at: new Timestamp('2026-09-30T12:00:00.000000Z'),
capture: CaptureMode::Usage,
sampled: true,
invocationId: 'invocation-1',
attempt: 1,
),
],
);
$json = EnvelopeCodec::encode($envelope);
$decoded = EnvelopeCodec::decode($json);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.