PHPackages                             processhub/laravel-logs - 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. processhub/laravel-logs

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

processhub/laravel-logs
=======================

ProcessHub centralized logging for Laravel applications — ships logs, exceptions, and deploy markers to ProcessHub's /api/ingest endpoints

v1.0.0(3mo ago)039MITPHPPHP ^8.1CI failing

Since Apr 19Pushed 2mo agoCompare

[ Source](https://github.com/id-jony/ProcessHub-laravel-logs)[ Packagist](https://packagist.org/packages/processhub/laravel-logs)[ Docs](https://processhub.io)[ RSS](/packages/processhub-laravel-logs/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (3)Dependencies (7)Versions (3)Used By (0)

ProcessHub Logs — Laravel package
=================================

[](#processhub-logs--laravel-package)

Ships logs, exceptions, and deploy markers from your Laravel application to [ProcessHub](https://processhub.io)'s centralised observability module. Get grouped exceptions, deploy-marker annotations on your event graph, and a single `requestId` trail across every log line of a user request.

> **Status**: MVP — production-ready for Laravel 10/11/12 on PHP 8.1+.

Install
-------

[](#install)

```
composer require processhub/laravel-logs
php artisan processhub:install
```

Then, per the install output:

1. Add credentials to `.env`:

    ```
    PROCESSHUB_LOG_URL=https://app.processhub.io
    PROCESSHUB_LOG_TOKEN=ph_live_

    ```

    Get the token at `ProcessHub → Приложения →  → Интеграция → Выпустить токен`. Copy immediately — it won't be shown again.
2. Register the logging channel in `config/logging.php`:

    ```
    'channels' => [
        // … existing channels
        'processhub' => [
            'driver' => 'custom',
            'via'    => ProcessHub\Logs\Logging\ProcessHubFactory::class,
            'level'  => env('LOG_LEVEL', 'warning'),
        ],
    ],
    'stack' => [
        'driver'   => 'stack',
        'channels' => ['single', 'processhub'],
        'ignore_exceptions' => false,
    ],
    ```
3. Verify end-to-end:

    ```
    php artisan processhub:test
    ```

    You should see a synthetic ERROR appear in the ProcessHub application detail page within a second.

That's it. Every `Log::error`/`warning`/`info` (above the channel's `level`) now queues an async batch to ProcessHub.

What it does
------------

[](#what-it-does)

- **Log::error/warning/info → ApplicationLog rows** in ProcessHub, with structured context (exception class + stack trace when a `Throwable` is in context).
- **Exception grouping** — ProcessHub computes a stable fingerprint from `class + normalized message + top frame` so `User 1234 not found` and `User 9876 not found` group together; regressions (resolved → new occurrence) flip the group back to `open` and emit a pipeline trigger.
- **Heartbeat** — `processhub:heartbeat` runs every minute via the app's scheduler. Status flips to `OFFLINE` after 3 missed beats.
- **Request-id correlation** — `CorrelateRequestId` middleware propagates `X-Request-Id` through Monolog's shared context; ProcessHub UI pivots on it to show every log line of one HTTP request.
- **Deploy markers** — run `php artisan processhub:deploy "$RELEASE" --commit="$SHA"` as the last step of your Forge/Envoyer/CI deploy script. The «Релизы» tab shows the timeline; open exception groups auto-resolve when their next deploy lands. Pass `--failed` to record an unsuccessful deploy. Without `--commit` the command tries `git rev-parse HEAD`. Version is a positional argument, not `--version` (Symfony reserves the latter for printing the framework version). `ProcessHub::markDeploy(...)` facade also works for in-process callers.
- **Queue-based delivery** — all batches go through a dedicated queue (`logs` by default). Retry on 5xx / network, honour `Retry-After` on 429, fall back to a local file on exhausted attempts so nothing is lost.
- **PII redaction at the source** — `password` / `token` / `authorization` / `api_key` / `cookie` keys become `[REDACTED]`; emails / JWTs / `Bearer …` / credit-card numbers in message strings are masked before leaving the app.
- **Structured event listeners** — failed queue jobs, skipped/failed scheduled tasks become typed log entries (`contextType=job` / `scheduled`). Slow-query capture is available but off by default.

Configuration
-------------

[](#configuration)

See `config/processhub.php` after publishing. Highlights:

EnvDefaultWhat`PROCESSHUB_LOG_URL`—Base URL of your ProcessHub tenant`PROCESSHUB_LOG_TOKEN`—`ph_live___``PROCESSHUB_LOG_QUEUE``logs`Queue name for `SendLogBatchJob``PROCESSHUB_LOG_CONNECTION`defaultQueue connection (`redis`, `database`, etc.)`PROCESSHUB_LOG_BATCH_SIZE``100`Max entries per batch (ProcessHub's hard limit)`PROCESSHUB_LOG_TIMEOUT_MS``5000`HTTP timeout`PROCESSHUB_HEARTBEAT_ENABLED``true`Disable if your env doesn't run the scheduler`PROCESSHUB_LOG_SLOW_QUERIES``false`Emit slow queries as logs`PROCESSHUB_SLOW_QUERY_MS``1000`Threshold when slow-query logging is onCustom redaction keys / patterns live in `config/processhub.php` under `redact.keys` and `redact.patterns`.

Commands
--------

[](#commands)

CommandWhat`processhub:install`Publish config + print manual-step checklist`processhub:test`Direct POST (no queue) to verify credentials / network`processhub:heartbeat`Single heartbeat ping; auto-scheduled every minute`processhub:flush-fallback`Re-ingest batches saved to `storage/logs/processhub-fallback.log` during outages`processhub:payouts:push`Incremental push of registered payout rows (auto-scheduled on `payouts.default_cron`)You can wire `processhub:flush-fallback` into your own schedule if you want more aggressive retries — the package doesn't schedule it automatically.

Payouts
-------

[](#payouts)

When your application is the data source for the ProcessHub Payouts module (tax-agent payout aggregation, see [ProcessHub docs — Payouts module](https://processhub.io/docs/16-payouts-module)), the package can ship payment rows to the same ingest tenant — no extra token, no extra endpoint to configure.

### 1. Register the model

[](#1-register-the-model)

In `app/Providers/AppServiceProvider.php::boot`:

```
use ProcessHub\Logs\Payouts\Payouts;
use App\Models\Payment;

Payouts::register(
    model: Payment::class,
    map: fn (Payment $p) => [
        'gatewayPaymentId'    => (string) $p->id,             // stable dedup key
        'paymentCreatedAt'    => $p->created_at->toIso8601String(),
        'rawStatus'           => $p->status_text,             // verbatim, ProcessHub maps it
        'isCompleted'         => (bool) $p->completed,
        'isFatalError'        => (bool) $p->fatal_error,
        'grossAmount'         => (string) $p->amount,         // string to keep кoпейки intact

        // Optional core ↓
        'externalTxnId'       => $p->transaction_id,
        'gatewayUpdatedAt'    => $p->updated_at?->toIso8601String(),
        'errorReason'         => $p->result_message,
        'recipientPhone'      => $p->phone,
        'recipientName'       => $p->fio,
        'recipientMaskedCard' => $p->card_masked,

        // Anything else ProcessHub-side RAW columns may need ↓
        'rawData' => $p->only(['method', 'tochka', 'service']),
    ],
    query: fn ($q) => $q->where('type', 'PR'), // optional scope
);
```

That's all the client code change you need. Everything else (HTTP, retries, watermark, observer hookup, scheduler) is wired in the service provider.

### 2. How it ships

[](#2-how-it-ships)

ModeWhenConfigured by**Cron**`processhub.payouts.default_cron` (overridden by `payoutSource.cadence.cronExpr` from server)`Schedule` hook in the service provider**On status change**Eloquent `created()`/`updated()` events on the registered modelAuto-registered observer when `payoutSource.cadence.mode` ∈ `['on-status-change', 'both']`**Manual**`Payouts::push($payment)` / `Payouts::queue($payment)`Anywhere in your codeThe high-watermark (max `gatewayPaymentId` shipped so far) lives in `storage/app/processhub-payouts-watermark.json`. It survives `cache:clear` and falls back to the server-provided `payoutSource.watermark` hint when missing — bootstrap is safe to restart.

### 3. Env reference

[](#3-env-reference)

EnvDefaultWhat`PROCESSHUB_PAYOUTS_ENABLED``true`Hard kill-switch (server `payoutSource.enabled` overrides)`PROCESSHUB_PAYOUTS_QUEUE``default`Queue for `PushSinglePayoutJob` (observer-driven)`PROCESSHUB_PAYOUTS_CONNECTION`—Queue connection override`PROCESSHUB_PAYOUTS_DEFAULT_CRON``0 * * * *`Used until the first heartbeat-config refresh pulls server cadence### 4. Failure semantics

[](#4-failure-semantics)

- **Server returns 4xx other than 429** → command exits FAILURE, watermark stays put, scheduler email fires. Fix the cause on the ProcessHub side (token, source config, formulas) and the next cron tick resumes.
- **429 / 5xx** → up to 3 retries with `Retry-After`-aware backoff inside one push; if still failing, watermark stays put and the next cron tick re-tries.
- **Bad mapper row** (mapper threw `InvalidArgumentException` on shape) → that row is skipped with a `WARNING` log; the rest of the batch ships.
- **413 Payload Too Large** → batch halved and retried; up to 3 split levels before giving up.
- **No model registered** → command exits SUCCESS silently with an `INFO` log; observer doesn't bind to anything.

How it fails
------------

[](#how-it-fails)

- **Network down** — `SendLogBatchJob` retries 3× with exponential backoff. On exhaustion, `failed()` appends the batch as JSON to `storage/logs/processhub-fallback.log`. Run `php artisan processhub:flush-fallback` once the network is back.
- **4xx from ProcessHub** (bad token, revoked token) — jobs fail immediately (no retries); batch appended to fallback file for later re-ingest after you fix config.
- **429 rate limit** — batch is released back to the queue with the `Retry-After` delay (no lost time on exponential backoff that doesn't fit ProcessHub's rate-limit window).
- **`Log::error` before config is set** — handler silently drops (the install command warns you).

Testing
-------

[](#testing)

```
composer install
vendor/bin/phpunit
```

Tests use [Orchestra Testbench](https://github.com/orchestral/testbench). There are unit tests for `Redactor` (pattern coverage), `CorrelateRequestId` middleware (validation + generation), and `SendLogBatchJob` (retry behaviour against a mocked Guzzle client).

Contract with ProcessHub
------------------------

[](#contract-with-processhub)

This package targets the ingest contract documented in [ProcessHub docs — Applications module](https://processhub.io/docs/13-applications-module). Key limits (as of 2026-04):

- 100 entries per batch
- 2 MB max payload
- 60 requests/min per token (sliding window)
- 16 KB max message; longer is truncated server-side
- 10 max JSON depth in context

If ProcessHub changes the contract, bump the package's minor version so apps can upgrade in lock-step.

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance85

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

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

Total

2

Last Release

64d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/84fb3553594fad44e19422f54f95d5f9a0d8065239412803eca4bbbb486b3ecb?d=identicon)[id-jony](/maintainers/id-jony)

---

Top Contributors

[![id-jony](https://avatars.githubusercontent.com/u/2923330?v=4)](https://github.com/id-jony "id-jony (8 commits)")

---

Tags

laravelloggingexceptionsmonologobservability

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/processhub-laravel-logs/health.svg)

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

###  Alternatives

[unopim/unopim

UnoPim Laravel PIM

10.5k2.4k](/packages/unopim-unopim)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k16](/packages/tempest-framework)[naoray/laravel-github-monolog

Log driver to store logs as github issues

10923.3k](/packages/naoray-laravel-github-monolog)[lion/bundle

Lion-framework configuration and initialization package

122.4k4](/packages/lion-bundle)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

293.1k](/packages/eslazarev-wildberries-sdk)

PHPackages © 2026

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