PHPackages                             treblle/oaas-laravel - 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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. treblle/oaas-laravel

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

treblle/oaas-laravel
====================

Laravel SDK for Treblle Observability as a Service (OaaS)

v1.0.7(2mo ago)17.7k↓39.5%MITPHPPHP ^8.1

Since Aug 27Pushed 2mo agoCompare

[ Source](https://github.com/Treblle/oaas-laravel)[ Packagist](https://packagist.org/packages/treblle/oaas-laravel)[ RSS](/packages/treblle-oaas-laravel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (8)Dependencies (12)Versions (9)Used By (0)

Treblle - API Intelligence Platform
===================================

[](#treblle---api-intelligence-platform)

[![Treblle API Intelligence](https://github.com/user-attachments/assets/b268ae9e-7c8a-4ade-95da-b4ac6fce6eea)](https://treblle.com)

[Website](http://treblle.com/) • [Documentation](https://docs.treblle.com/) • [Pricing](https://treblle.com/pricing)

Treblle is an API intelligence platfom that helps developers, teams and organizations understand their APIs from a single integration point.

---

Treblle Laravel OaaS SDK
------------------------

[](#treblle-laravel-oaas-sdk)

A Laravel SDK for Treblle Observability as a Service (OaaS). Easily retrieve and filter requests from APIs monitored by Treblle and expose that data to your end-customers.

Requirements
------------

[](#requirements)

- PHP 8.1 or higher
- Laravel 10.0 or higher
- Guzzle HTTP 7.0 or higher

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

[](#installation)

Install the package via Composer:

```
composer require treblle/oaas-laravel
```

### Laravel Setup

[](#laravel-setup)

The package will automatically register its service provider. Publish the configuration file:

```
php artisan vendor:publish --tag=treblle-oaas-config
```

### Configuration

[](#configuration)

Add your Treblle OaaS API token to your `.env` file:

```
TREBLLE_OAAS_API_TOKEN=your_api_token_here
```

You can obtain your API token from the [Treblle Identity Dashboard](https://identity.treblle.com/developer-settings) under Developer Settings.

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

To use the SDK you will need to pass your Workspace ID (found in Workspace Settings on the Treblle Dashboard) and your API ID (found in API Settings on the Treblle Dashboard)

```
use Treblle\OaaS\Facades\TreblleOaaS;

// Get all requests for a customer
$requests = TreblleOaaS::requests('workspace-id', 'api-id')
    ->whereCustomer('customer-123')
    ->get();

foreach ($requests as $request) {
    echo "Request: {$request->getMethod()} {$request->getPath()}" . PHP_EOL;
    echo "Status: {$request->getHttpCode()}" . PHP_EOL;
    echo "Load Time: {$request->getLoadTimeMs()}ms" . PHP_EOL;
}
```

### Advanced Filtering

[](#advanced-filtering)

The SDK provides a fluent API for filtering requests:

```
use Treblle\OaaS\Enums\HttpMethod;
use Treblle\OaaS\Enums\Device;
use Treblle\OaaS\Enums\TimePeriod;

$requests = TreblleOaaS::requests('workspace-id', 'api-id')
    ->whereCustomer('customer-123')
    ->whereMethod(HttpMethod::POST)
    ->whereDevice(Device::IOS)
    ->whereTimePeriod(TimePeriod::LAST_24_HOURS)
    ->whereSuccessful() // 2xx status codes
    ->withoutProblems()
    ->sortByLoadTimeSlowest()
    ->limit(10)
    ->get();

// Custom time range filtering (alternative to whereTimePeriod)
$requests = TreblleOaaS::requests('workspace-id', 'api-id')
    ->whereCustomer('customer-123')
    ->whereTimeRange('2025-09-01 00:00:00', '2025-09-30 23:59:59')
    ->get();

// Get all-time requests
$requests = TreblleOaaS::requests('workspace-id', 'api-id')
    ->whereCustomer('customer-123')
    ->allTime()
    ->get();

// Search checkout requests for specific payment methods
$requests = TreblleOaaS::requests('workspace-id', 'api-id')
    ->whereCustomer('customer-123')
    ->withParams('stripe') // Find requests with Stripe payment data
    ->whereMethod(HttpMethod::POST)
    ->get();

// Find user registration attempts with Gmail addresses
$requests = TreblleOaaS::requests('workspace-id', 'api-id')
    ->whereCustomer('customer-123')
    ->withParams('@gmail.com') // Partial match on email domains
    ->get();
```

### Pagination

[](#pagination)

```
// Get paginated results
$page1 = TreblleOaaS::requests('workspace-id', 'api-id')
    ->whereCustomer('customer-123')
    ->paginate(perPage: 20, page: 1);

echo "Total requests: {$page1->total()}" . PHP_EOL;
echo "Current page: {$page1->currentPage()} / {$page1->totalPages()}" . PHP_EOL;

// Check if there are more pages
if ($page1->hasNextPage()) {
    $page2 = TreblleOaaS::requests('workspace-id', 'api-id')
        ->whereCustomer('customer-123')
        ->paginate(perPage: 20, page: 2);
}
```

### Request Details

[](#request-details)

Get detailed information about a specific request:

```
$requestDetails = TreblleOaaS::getRequest('workspace-id', 'api-id', 'request-id');

echo "Request URL: {$requestDetails->getRequestUrl()}" . PHP_EOL;
echo "Response Body: " . json_encode($requestDetails->getResponseBody()) . PHP_EOL;
echo "Server Info: " . json_encode($requestDetails->getServerInfo()) . PHP_EOL;

// Check compliance and security
if ($requestDetails->hasProblem()) {
    echo "Request has problems: " . json_encode($requestDetails->getProblem()) . PHP_EOL;
}

$compliance = $requestDetails->getComplianceReport();
echo "Compliance Status: {$compliance['status']}" . PHP_EOL;
echo "Compliance Score: {$compliance['overall_percentage']}%" . PHP_EOL;
```

### Available Filters

[](#available-filters)

Filter MethodDescription`whereCustomer(string $customerId)`Filter by external user/customer ID`whereLocation(string $location)`Filter by geographic location`withParams(string $params)`Filter by request parameters`whereMethod(HttpMethod $method)`Filter by HTTP method`whereDevice(Device $device)`Filter by device type (iOS/Android/Desktop)`whereHttpCode(int|string $code)`Filter by HTTP status code`whereSuccessful()`Filter for 2xx responses`whereClientError()`Filter for 4xx responses`whereServerError()`Filter for 5xx responses`whereTimePeriod(TimePeriod $period)`Filter by time period`whereTimeRange(string $start, string $end)`Filter by custom date range (YYYY-MM-DD HH:MM:SS format)`allTime()`Get all requests regardless of time period`withProblems()`Only requests with problems`withoutProblems()`Only requests without problems### Sorting Options

[](#sorting-options)

Sort MethodDescription`sortByCreatedAtDesc()`Most recent first (default)`sortByCreatedAtAsc()`Oldest first`sortByLoadTimeFastest()`Fastest requests first`sortByLoadTimeSlowest()`Slowest requests first### Helper Methods

[](#helper-methods)

Request summary objects provide helpful methods:

```
foreach ($requests as $request) {
    // Status checks
    if ($request->isSuccessful()) {
        echo "✅ Successful request" . PHP_EOL;
    } elseif ($request->hasClientError()) {
        echo "⚠️ Client error: {$request->getHttpCode()}" . PHP_EOL;
    } elseif ($request->hasServerError()) {
        echo "❌ Server error: {$request->getHttpCode()}" . PHP_EOL;
    }

    // Performance checks
    if ($request->isLoadTimeFast()) {
        echo "⚡ Fast response: {$request->getLoadTimeMs()}ms" . PHP_EOL;
    } else {
        echo "🐌 Slow response: {$request->getLoadTimeMs()}ms" . PHP_EOL;
    }

    // Customer info
    if ($displayName = $request->getCustomerDisplayName()) {
        echo "Customer: {$displayName}" . PHP_EOL;
    }

    // Security info
    echo "Threat Level: {$request->getThreatLevel()}" . PHP_EOL;
    echo "Has Auth: " . ($request->hasAuth() ? 'Yes' : 'No') . PHP_EOL;
}
```

Configuration Options
---------------------

[](#configuration-options)

The configuration file allows you to customize various aspects:

```
return [
    // API Configuration
    'api_token' => env('TREBLLE_OAAS_API_TOKEN'),
    'base_url' => env('TREBLLE_OAAS_BASE_URL', 'https://api-forge.treblle.com/api/v1'),

    // Request Timeouts
    'timeout' => env('TREBLLE_OAAS_TIMEOUT', 30),
    'connect_timeout' => env('TREBLLE_OAAS_CONNECT_TIMEOUT', 10),

    // Pagination Defaults
    'default_limit' => env('TREBLLE_OAAS_DEFAULT_LIMIT', 20),
    'max_limit' => env('TREBLLE_OAAS_MAX_LIMIT', 50),
];
```

Error Handling
--------------

[](#error-handling)

The SDK throws `OaaSException` for API errors:

```
use Treblle\OaaS\Exceptions\OaaSException;

try {
    $requests = TreblleOaaS::requests('workspace-id', 'api-id')
        ->whereCustomer('customer-123')
        ->get();
} catch (OaaSException $e) {
    echo "API Error: {$e->getMessage()}" . PHP_EOL;
    echo "HTTP Status: {$e->getCode()}" . PHP_EOL;

    if ($e->hasResponse()) {
        $responseData = $e->getResponseData();
        echo "Response: " . json_encode($responseData) . PHP_EOL;
    }
}
```

Data Models
-----------

[](#data-models)

The SDK provides rich data models:

- `RequestCollection` - Collection of request summaries with pagination
- `RequestSummary` - Summary information about a request
- `RequestDetails` - Complete request details including headers, body, compliance, etc.
- `PaginationMeta` - Pagination metadata
- `PaginationLinks` - Pagination navigation links

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

Support
-------

[](#support)

For support, please visit [Treblle's documentation](https://docs.treblle.com) or contact .

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance87

Actively maintained with recent releases

Popularity27

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 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

Every ~28 days

Recently: every ~45 days

Total

8

Last Release

64d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/795076376a2a3f5c648841fcc7da9d93c65184a815537c06639298f3997e264d?d=identicon)[cindreta](/maintainers/cindreta)

---

Top Contributors

[![cindreta](https://avatars.githubusercontent.com/u/628464?v=4)](https://github.com/cindreta "cindreta (11 commits)")

---

Tags

apiobservabilitysdktreblleapilaravelmonitoringsdkobservabilityintelligencetreblle

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/treblle-oaas-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/treblle-oaas-laravel/health.svg)](https://phpackages.com/packages/treblle-oaas-laravel)
```

###  Alternatives

[treblle/security-headers

A collection of HTTP middleware classes to improve the security headers in your Laravel application.

9534.3k](/packages/treblle-security-headers)[treblle/treblle-api-tools-laravel

A set of useful tools for building APIs in Laravel.

135.3k1](/packages/treblle-treblle-api-tools-laravel)

PHPackages © 2026

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