PHP code example of michaeldrennen / bugsnag-api-client

1. Go to this page and download the library: Download michaeldrennen/bugsnag-api-client 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/ */

    

michaeldrennen / bugsnag-api-client example snippets


use MichaelDrennen\BugSnagApiClient\BugsnagApiClient;

-token';
$client = new BugsnagApiClient($token);

$organizations = $client->getOrganizations();

foreach ($organizations as $org) {
    echo "Organization ID: " . $org['id'] . " - Name: " . $org['name'] . "\n";
}

$orgId = '50baed0d9bf39c1431000003';
$organization = $client->getOrganization($orgId);

$projects = $client->getProjects($orgId);

foreach ($projects as $project) {
    echo "Project ID: " . $project['id'] . " - Name: " . $project['name'] . "\n";
}

$projectId = 'project-id-string';

// Fetch open errors
$filters = [
    'base_error.status' => 'open'
];

$errors = $client->getErrors($projectId, $filters);

$errorId = 'error-id-string';
$error = $client->getError($projectId, $errorId);

$events = $client->getEvents($projectId);

$eventId = 'event-id-string';
$event = $client->getEvent($projectId, $eventId);

// Fetch users for an organization
$users = $client->get("organizations/{$orgId}/users");