PHPackages                             logstream/laravel-sdk - 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. logstream/laravel-sdk

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

logstream/laravel-sdk
=====================

Laravel SDK for LogStream — send your application logs to your self-hosted LogStream instance in real time

v1.0.0(1mo ago)0100—0%MITPHPPHP ^8.2

Since Jun 5Pushed 1mo agoCompare

[ Source](https://github.com/cloud-dfe/logstream-sdk-php)[ Packagist](https://packagist.org/packages/logstream/laravel-sdk)[ Docs](https://github.com/cloud-dfe/logstream-sdk)[ RSS](/packages/logstream-laravel-sdk/feed)WikiDiscussions master Synced 1w ago

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

LogStream PHP SDK
=================

[](#logstream-php-sdk)

PHP SDK for [LogStream](https://github.com/cloud-dfe/logstream-sdk-php) — a self-hosted log aggregator inspired by Papertrail.

Sends your application logs to your LogStream instance in real time. Works with any PHP project — no framework required.

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

[](#requirements)

- PHP 7.2+
- cURL extension enabled
- A running LogStream instance

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

[](#installation)

```
composer require logstream/laravel-sdk
```

---

Standalone usage (any PHP project)
----------------------------------

[](#standalone-usage-any-php-project)

Zero dependencies. Works with pure PHP 7.2+.

```
use LogStream\LogStreamClient;

$log = new LogStreamClient(
    'https://your-logstream.com',
    'src_your_token_here',
    'my-app',        // source
    'production'     // environment
);

$log->info('User authenticated', ['user_id' => 42]);
$log->warning('Rate limit reached', ['requests' => 480]);
$log->error('Payment failed', ['order_id' => 99]);
$log->debug('Query executed', ['time_ms' => 12]);
```

Available methods: `debug`, `info`, `notice`, `warning`, `error`, `critical`, `alert`, `emergency`.

Or use the generic method:

```
$log->log('error', 'Something went wrong', ['code' => 500]);
```

### Constructor parameters

[](#constructor-parameters)

ParameterTypeDefaultDescription`$url`string—Base URL of your LogStream instance`$token`string—Source token (starts with `src_`)`$source`string`php-app`Identifier for this application`$environment`string`production`Current environment name`$hostname`string|nullauto-detectedServer hostname`$timeout`int`3`cURL timeout in seconds---

Laravel integration
-------------------

[](#laravel-integration)

Uses Laravel's `custom` driver with a Monolog handler internally. No extra packages needed — Monolog is already part of Laravel.

### 1. Add the channel to `config/logging.php`

[](#1-add-the-channel-to-configloggingphp)

```
use LogStream\Laravel\LogStreamChannel;

'channels' => [

    'logstream' => [
        'driver' => 'custom',
        'via'    => LogStreamChannel::class,
        'url'    => env('LOGSTREAM_URL'),
        'token'  => env('LOGSTREAM_TOKEN'),
        'source' => env('LOGSTREAM_SOURCE', 'my-app'),
    ],

    // To log both locally and to LogStream at the same time:
    'stack' => [
        'driver'   => 'stack',
        'channels' => ['daily', 'logstream'],
    ],

],
```

### 2. Add to `.env`

[](#2-add-to-env)

```
LOG_CHANNEL=stack

LOGSTREAM_URL=https://your-logstream.com
LOGSTREAM_TOKEN=src_your_token_here
LOGSTREAM_SOURCE=my-app-name
```

The token is generated in the LogStream dashboard under **Sources → Create Source**.

### 3. Use normally

[](#3-use-normally)

All `Log::*` calls are forwarded to LogStream automatically:

```
Log::info('User authenticated', ['user_id' => 42]);
Log::error('Payment failed', ['order_id' => 99]);

// Or send only to LogStream:
Log::channel('logstream')->warning('Rate limit reached');
```

---

PSR-3 usage
-----------

[](#psr-3-usage)

For projects that require a `Psr\Log\LoggerInterface` (e.g. dependency injection containers, third-party libraries), install `psr/log` first:

```
composer require psr/log
```

Then wrap the client:

```
use LogStream\LogStreamClient;
use LogStream\Logger\LogStreamLogger;

$client = new LogStreamClient('https://your-logstream.com', 'src_token', 'my-app');
$logger = new LogStreamLogger($client);

// $logger now implements Psr\Log\LoggerInterface
$logger->info('Hello', ['user_id' => 1]);
```

Useful when injecting the logger into a class that depends on the interface:

```
class PaymentService
{
    public function __construct(private \Psr\Log\LoggerInterface $logger) {}

    public function process(int $orderId): void
    {
        $this->logger->info('Processing payment', ['order_id' => $orderId]);
    }
}

$service = new PaymentService(new LogStreamLogger($client));
```

---

Error handling
--------------

[](#error-handling)

All errors during log delivery (network failures, timeouts, invalid responses) are silently swallowed. Logging will never crash your application.

---

License
-------

[](#license)

MIT

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance90

Actively maintained with recent releases

Popularity13

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

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 ~0 days

Total

2

Last Release

49d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8d9506d75cbd05659ce9ea48658ba68d46f507152945585372f4547a07e0d740?d=identicon)[ClevertonSouza](/maintainers/ClevertonSouza)

---

Top Contributors

[![icompsoftcleiton](https://avatars.githubusercontent.com/u/6797894?v=4)](https://github.com/icompsoftcleiton "icompsoftcleiton (1 commits)")

---

Tags

laravelloggingmonologlogstreamlog aggregator

### Embed Badge

![Health badge](/badges/logstream-laravel-sdk/health.svg)

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

###  Alternatives

[naoray/laravel-github-monolog

Log driver to store logs as github issues

10923.3k](/packages/naoray-laravel-github-monolog)[shaffe/laravel-mail-log-channel

A package to support logging via email in Laravel

1395.1k](/packages/shaffe-laravel-mail-log-channel)

PHPackages © 2026

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