1. Go to this page and download the library: Download mesh0/sdk 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/ */
mesh0 / sdk example snippets
use Mesh0\Client;
use Mesh0\Event\Event;
$mesh0 = Client::create('m0_abcde_xxxxxxxxxxxxxxxxxxxxxxxx');
// Send a single event. The wire shape is intentionally narrow — identity,
// time, plus two open bins (`attributes` queryable, `data` opaque).
// Anything domain-specific goes inside attributes / data.
$mesh0->events->send(
Event::now()
->withAttributes([
'app.id' => 'checkout',
'app.environment' => 'prod',
'span.name' => 'charge.captured',
'user.id' => 'user_42',
'order_id' => 'ord_123',
'amount_usd' => 19.99,
]),
);
// Only the identity/time TQL builtins resolve at the top level:
// `timestamp, project.id, trace.id, span.id, parent_span.id`. Anything
// else (status, duration_ms, span.name, gen_ai.*, …) must be exposed via
// a per-project alias or promoted column — set those up in the dashboard,
// then reference them by their alias name here.
$rows = $mesh0->query->run([
'from' => 'events',
'select' => ['status', 'count()'],
'where' => ['status' => 'error'],
'groupBy' => ['status'],
'orderBy' => [['count()', 'desc']],
'limit' => 25,
]);
$page = $mesh0->events->list(limit: 100);
foreach ($page['events'] as $row) { /* … */ }
// Or stream every event, transparently following cursors:
foreach ($mesh0->events->iterate() as $row) { /* … */ }
use Mesh0\Client;
use Mesh0\Config;
$mesh0 = new Client(new Config(
apiKey: 'm0_abcde_xxxxxxxxxxxxxxxxxxxxxxxx',
baseUrl: 'https://api.mesh0.ai',
timeout: 10.0,
connectTimeout: 5.0,
maxRetries: 2,
userAgent: 'my-app/1.0',
defaultHeaders: ['X-Tenant' => 'acme'],
));
use GuzzleHttp\Client as Guzzle;
use GuzzleHttp\Psr7\HttpFactory;
$guzzle = new Guzzle(['timeout' => 5]);
$factory = new HttpFactory();
$mesh0 = new Client(Config::fromEnv(), $guzzle, $factory, $factory);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.