PHPackages                             michaeldrennen/bugsnag-api-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. michaeldrennen/bugsnag-api-client

ActiveLibrary[API Development](/categories/api)

michaeldrennen/bugsnag-api-client
=================================

A PHP client library to interface with the BugSnag API.

v1.0(1mo ago)0108MITPHP

Since Apr 23Pushed 1mo agoCompare

[ Source](https://github.com/michaeldrennen/BugSnagApiClient)[ Packagist](https://packagist.org/packages/michaeldrennen/bugsnag-api-client)[ RSS](/packages/michaeldrennen-bugsnag-api-client/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

BugSnagApiClient
================

[](#bugsnagapiclient)

A robust PHP client library designed to easily interface with the **Bugsnag Data Access API (v2)**.

Installation
------------

[](#installation)

Install the package via Composer:

```
composer require michaeldrennen/bugsnag-api-client
```

Authentication
--------------

[](#authentication)

To use this client, you must generate a **Personal Auth Token** from your Bugsnag dashboard.

1. Log in to Bugsnag.
2. Go to **Settings &gt; My Account &gt; Personal auth tokens**.
3. Generate a new token.

> **Note:** This token is different from your project-level "API Key" used for reporting errors.

Finding IDs and Credentials
---------------------------

[](#finding-ids-and-credentials)

Many API endpoints require specific IDs (like an Organization ID or Project ID). While you can extract these programmatically using the API itself (e.g., calling `$client->getOrganizations()`), you can also find them manually in your Bugsnag dashboard:

- **Organization ID:** In the Bugsnag dashboard, navigate to **Settings &gt; Organization settings**. The Organization ID is typically the 24-character hexadecimal string found in the URL. (e.g., `https://app.bugsnag.com/settings/organizations/50baed0d9bf39c1431000003/...`)
- **Project ID:** Navigate to **Settings &gt; Project settings**. Similar to the organization, the Data Access API requires the 24-character hexadecimal Project ID, which can be found in the URL while viewing the project settings.
- **Error ID &amp; Event ID:** When viewing a specific error or event in your Bugsnag dashboard, the long alphanumeric strings present in the URL are the respective IDs.

Basic Usage
-----------

[](#basic-usage)

Instantiate the client by passing your Personal Auth Token.

```
use MichaelDrennen\BugSnagApiClient\BugsnagApiClient;

require 'vendor/autoload.php';

// Initialize the client
$token = 'your-personal-auth-token';
$client = new BugsnagApiClient($token);
```

### Retrieving Organizations

[](#retrieving-organizations)

Get a list of all organizations your user account belongs to:

```
$organizations = $client->getOrganizations();

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

Get details for a specific organization by its ID:

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

### Retrieving Projects

[](#retrieving-projects)

Fetch all projects under a specific organization:

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

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

### Retrieving Errors and Events

[](#retrieving-errors-and-events)

Fetch a list of errors for a given project. You can optionally pass an array of query parameters to filter the results according to the Bugsnag API documentation.

```
$projectId = 'project-id-string';

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

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

Get details for a specific error:

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

Fetch events (individual occurrences of an error):

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

Get details for a specific event:

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

### Making Custom Requests

[](#making-custom-requests)

If you need to hit an endpoint that isn't explicitly mapped in the client, you can use the generic `get()` method.

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

Testing
-------

[](#testing)

This package uses PHPUnit for testing. The test suite includes both mocked unit tests and live integration tests.

### Running Unit Tests

[](#running-unit-tests)

Unit tests mock the Guzzle HTTP client, so no real API requests are made.

```
composer run-script test
# or
./vendor/bin/phpunit
```

### Running Integration Tests

[](#running-integration-tests)

To run the integration tests against the live Bugsnag API:

1. Copy `phpunit.xml.dist` to `phpunit.xml`.
2. Open `phpunit.xml` and replace `your-real-token-here` with your actual Bugsnag Personal Auth Token.
3. Run PHPUnit:

```
./vendor/bin/phpunit
```

> **Warning:** Do not commit `phpunit.xml` to version control if it contains your real API token. The `.gitignore` file is already configured to ignore it.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance90

Actively maintained with recent releases

Popularity13

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

47d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b701baeed9e105a4a117e363b478d932306516c9365b4f2e3ef2dfed358f608b?d=identicon)[michaeldrennen](/maintainers/michaeldrennen)

---

Top Contributors

[![michaeldrennen](https://avatars.githubusercontent.com/u/5288190?v=4)](https://github.com/michaeldrennen "michaeldrennen (5 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/michaeldrennen-bugsnag-api-client/health.svg)

```
[![Health](https://phpackages.com/badges/michaeldrennen-bugsnag-api-client/health.svg)](https://phpackages.com/packages/michaeldrennen-bugsnag-api-client)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3751.2M45](/packages/tencentcloud-tencentcloud-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

1.9k496.1k32](/packages/neuron-core-neuron-ai)[avalara/avataxclient

Client library for Avalara's AvaTax suite of business tax calculation and processing services. Uses the REST v2 API.

528.3M7](/packages/avalara-avataxclient)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

232.5k](/packages/eslazarev-wildberries-sdk)[files.com/files-php-sdk

Files.com PHP SDK

2478.1k](/packages/filescom-files-php-sdk)[aimeos/prisma

A powerful PHP package for integrating media related Large Language Models (LLMs) into your applications

1772.4k4](/packages/aimeos-prisma)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
