PHPackages                             mindtwo/laravel-monitoring - 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. mindtwo/laravel-monitoring

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

mindtwo/laravel-monitoring
==========================

Laravel plugin of the mindtwo monitoring suite: framework-specific collectors, a scheduled push job and a signed pull endpoint on top of mindtwo/base-monitoring.

v1.0.0(1mo ago)098MITPHPPHP ^8.1CI passing

Since Jun 19Pushed 1mo agoCompare

[ Source](https://github.com/mindtwo/laravel-monitoring)[ Packagist](https://packagist.org/packages/mindtwo/laravel-monitoring)[ Docs](https://github.com/mindtwo/laravel-monitoring)[ RSS](/packages/mindtwo-laravel-monitoring/feed)WikiDiscussions main Synced 2w ago

READMEChangelogDependencies (13)Versions (2)Used By (0)

mindtwo/laravel-monitoring
==========================

[](#mindtwolaravel-monitoring)

[![Tests](https://github.com/mindtwo/laravel-monitoring/actions/workflows/tests.yml/badge.svg)](https://github.com/mindtwo/laravel-monitoring/actions/workflows/tests.yml)[![Larastan Level 8](https://camo.githubusercontent.com/7bdf89a5366537e7e97c2453e4229ee3c16badff1aca0f7866478eea6aeafb86/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6172617374616e2d6c6576656c253230382d627269676874677265656e)](phpstan.neon.dist)[![PHP 8.1+](https://camo.githubusercontent.com/cc9cdea9aa96b40a822425e981b0a030e3371202973c7d57b74e8e99834f81dc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e312d626c7565)](composer.json)[![Laravel 10–13](https://camo.githubusercontent.com/f9f1aee5261b3b9aa8b1f3094ea1fe03a38308a41ba790f53ec2a6a767a81137/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d31302532302537432532303131253230253743253230313225323025374325323031332d726564)](composer.json)[![License: MIT](https://camo.githubusercontent.com/be07a68b57a673af622198c336264f89d82bf4cd5d87bc0cb3f7b6ae47cc43ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d6c6967687467726579)](LICENSE.md)

Laravel plugin of the mindtwo monitoring suite. On top of [`mindtwo/base-monitoring`](https://github.com/mindtwo/base-monitoring) — which collects OS, web server, database, Node.js, system stats, Composer/npm packages, security audits, licenses and git status — this package adds:

- **Laravel collectors** — framework version, operational environment (debug flag, maintenance mode, drivers, optimization caches) and the **live database server version** from your actual connection.
- **Push** — a scheduled `monitoring:push` run delivering signed snapshots to the central endpoint.
- **Pull** — a throttled, HMAC-authenticated `GET /api/m2-monitoring` endpoint with optional IP allow-listing and short-lived snapshot caching.
- **DX tooling** — `monitoring:show`, `monitoring:push --dry-run`, `monitoring:collectors`, `php artisan about` integration and a facade for custom data.

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

[](#installation)

```
composer require mindtwo/laravel-monitoring
```

Set your credentials (issued by the monitoring dashboard) in `.env`:

```
MONITORING_PROJECT_KEY=prj_live_8f3a…
MONITORING_SECRET=base64-encoded-shared-secret
```

That's it. The service provider auto-registers, the pull endpoint goes live at `/api/m2-monitoring`, and a push is scheduled daily at 03:00 — provided your [scheduler](https://laravel.com/docs/scheduling) is running.

Publish the config when you need to customize more:

```
php artisan vendor:publish --tag=monitoring-config
```

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

[](#configuration)

Everything is configurable via `.env` without publishing:

VariableDefaultPurpose`MONITORING_ENABLED``true`Master switch for route + schedule`MONITORING_PROJECT_KEY`–Project key from the dashboard`MONITORING_SECRET`–Shared secret (never transmitted)`MONITORING_ENDPOINT``https://monitoring.mindtwo.com/api/monitoring`Push target`MONITORING_ENVIRONMENT``app()->environment()`Reported environment`MONITORING_TIMEOUT``15`Push timeout (seconds)`MONITORING_ROUTE_ENABLED``true`Expose the pull endpoint`MONITORING_ROUTE_PATH``api/m2-monitoring`Pull endpoint path`MONITORING_ROUTE_CACHE``300`Pull snapshot cache (seconds, `0` disables)`MONITORING_RATE_LIMIT``10`Pull requests per minute per IP`MONITORING_SIGNATURE_TOLERANCE``300`Signature timestamp window (seconds)`MONITORING_IP_ALLOW_LIST`–Comma-separated IPs / CIDR ranges`MONITORING_SCHEDULE_ENABLED``true`Register the scheduled push`MONITORING_SCHEDULE_CRON``0 3 * * *`Push cron expression`MONITORING_SCHEDULE_TIMEZONE`app timezoneCron timezoneArtisan commands
----------------

[](#artisan-commands)

```
php artisan monitoring:show              # human-readable snapshot table
php artisan monitoring:show --json       # the full payload
php artisan monitoring:push --dry-run    # print what would be sent
php artisan monitoring:push              # build + deliver a snapshot now
php artisan monitoring:collectors        # registered collectors + support status
```

`monitoring:show` example:

```
+---------------------+--------+----------------------------+
| Metric              | Status | Details                    |
+---------------------+--------+----------------------------+
| os                  | ok     | macos 14.4.1               |
| php                 | ok     | php 8.3.2                  |
| database            | ok     | mysql 8.0.36               |
| laravel             | ok     | laravel 11.9.0             |
| composer_packages   | ok     | 73 packages                |
| composer_audit      | ok     |                            |
| nginx               | unsup… |                            |
+---------------------+--------+----------------------------+

```

The pull endpoint
-----------------

[](#the-pull-endpoint)

`GET /api/m2-monitoring` returns the current snapshot as JSON. Every request must be signed:

```
X-Monitoring-Key:
X-Monitoring-Timestamp:
X-Monitoring-Signature: hex( hmac_sha256( ".", secret ) )

```

The body of a pull GET is empty, so the signed string is simply `"."`. Example:

```
TIMESTAMP=$(date +%s)
SIGNATURE=$(printf '%s.' "$TIMESTAMP" | openssl dgst -sha256 -hmac "$MONITORING_SECRET" -hex | sed 's/^.* //')

curl https://example.com/api/m2-monitoring \
  -H "X-Monitoring-Key: $MONITORING_PROJECT_KEY" \
  -H "X-Monitoring-Timestamp: $TIMESTAMP" \
  -H "X-Monitoring-Signature: $SIGNATURE"
```

Defense layers, in request order:

1. **Rate limiting** — 10 requests/minute per IP by default (`throttle:monitoring`).
2. **IP allow-list** *(optional)* — plain IPs and CIDR ranges, IPv4 + IPv6. Behind a load balancer, configure [trusted proxies](https://laravel.com/docs/requests#configuring-trusted-proxies)so the client IP resolves correctly.
3. **Signature verification** — constant-time HMAC comparison plus a timestamp tolerance window against replays. Unconfigured credentials answer `503` and never expose data.
4. **Snapshot caching** — responses are cached for 5 minutes by default, keeping repeated polls from re-running expensive audit collectors.

Customizing
-----------

[](#customizing)

### Choose or add collectors

[](#choose-or-add-collectors)

The `collectors` config array is the single source of truth — reorder, remove, or add entries. Every class is resolved through the container:

```
// config/monitoring.php
'collectors' => [
    // ...defaults...
    \App\Monitoring\HorizonCollector::class,
],
```

```
namespace App\Monitoring;

use Mindtwo\Monitoring\Collectors\AbstractCollector;
use Mindtwo\Monitoring\Data\CollectionResult;

final class HorizonCollector extends AbstractCollector
{
    public function key(): string
    {
        return 'horizon';
    }

    public function collect(): CollectionResult
    {
        return CollectionResult::ok($this->key(), [
            'status' => 'running',
        ]);
    }
}
```

### Attach custom data

[](#attach-custom-data)

```
use Mindtwo\Monitoring\Laravel\Facades\Monitoring;

Monitoring::addCustomData('deployment', fn () => [
    'region' => config('app.region'),
    'release' => exec_free_release_id(),
]);
```

Closures are evaluated lazily and fault-isolated — a throwing provider records an error under its key instead of breaking the snapshot.

### Replace the transport

[](#replace-the-transport)

Bind your own `Mindtwo\Monitoring\Contracts\Transport` implementation to ship snapshots anywhere else (S3, a queue, a different protocol):

```
$this->app->singleton(\Mindtwo\Monitoring\Contracts\Transport::class, MyTransport::class);
```

How pushing works
-----------------

[](#how-pushing-works)

`monitoring:push` is registered on the scheduler (daily at 03:00 by default) with `withoutOverlapping()`, `onOneServer()` and `runInBackground()`. The command builds a snapshot — every collector individually fault-isolated — signs the JSON payload and POSTs it through Laravel's HTTP client, so `Http::fake()` sees it in your tests.

Delivery failures exit non-zero with a clear message; they never throw.

Testing your integration
------------------------

[](#testing-your-integration)

```
use Illuminate\Support\Facades\Http;

Http::fake(['monitoring.mindtwo.com/*' => Http::response('', 200)]);

$this->artisan('monitoring:push')->assertExitCode(0);

Http::assertSent(fn ($request) => $request->hasHeader('X-Monitoring-Signature'));
```

Development
-----------

[](#development)

```
composer install
composer check    # pint --test + larastan (level 8) + pest
```

Security
--------

[](#security)

If you discover a security issue, please email instead of opening a public issue.

License
-------

[](#license)

The MIT License (MIT). See [LICENSE.md](LICENSE.md).

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance92

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

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

Unknown

Total

1

Last Release

41d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4cc86fe6179314d204b14d1c81eb09a87ef84b0bcf2360dcd981171d1346c077?d=identicon)[mindtwo](/maintainers/mindtwo)

---

Top Contributors

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

---

Tags

laravelmonitoringsecurityinfrastructuremindtwo

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/mindtwo-laravel-monitoring/health.svg)

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.3M348](/packages/psalm-plugin-laravel)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

78622.3M192](/packages/laravel-mcp)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M134](/packages/roots-acorn)[laravel/boost

Laravel Boost accelerates AI-assisted development by providing the essential context and structure that AI needs to generate high-quality, Laravel-specific code.

3.5k21.5M693](/packages/laravel-boost)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)

PHPackages © 2026

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