PHP code example of beemlabs / beem-php

1. Go to this page and download the library: Download beemlabs/beem-php 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/ */

    

beemlabs / beem-php example snippets


use Beem\Beem;

Beem::init(['dsn' => 'https://[email protected]/shop-api']);

$tx = Beem::startTransaction('GET /orders/{id}', 'http.server');
try {
    $span = $tx->startSpan('db.query', 'SELECT * FROM orders WHERE id = ?');
    $orders = $db->query('SELECT * FROM orders WHERE id = ?', [$id]);
    $span->finish(12.3);
} catch (\Throwable $e) {
    Beem::captureException($e);
    throw $e;
} finally {
    Beem::finishTransaction(200);
    Beem::flush();
}
bash
composer