PHPackages                             mathiasgrimm/netwatch - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. mathiasgrimm/netwatch

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mathiasgrimm/netwatch
=====================

Network service latency probing tool for PHP — measures Redis, PostgreSQL, MySQL, S3, HTTP endpoints with statistical analysis

v2.0.0(2w ago)0843↑141.7%MITPHPPHP ^8.3CI passing

Since Jul 14Pushed 4mo agoCompare

[ Source](https://github.com/mathiasgrimm/netwatch)[ Packagist](https://packagist.org/packages/mathiasgrimm/netwatch)[ RSS](/packages/mathiasgrimm-netwatch/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (7)Dependencies (8)Versions (13)Used By (0)

 [![Netwatch](https://raw.githubusercontent.com/mathiasgrimm/netwatch/main/art/banner.avif)](https://raw.githubusercontent.com/mathiasgrimm/netwatch/main/art/banner.avif)

Netwatch
========

[](#netwatch)

> Know your latency before your users do. Statistical network probing for Redis, databases, S3, and HTTP - from the CLI or inside Laravel.

 [![Latest Version on Packagist](https://camo.githubusercontent.com/0083169505ca73499280200276b85845c358b9a2525eec99beaa84a92dd1f562/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6174686961736772696d6d2f6e657477617463682e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mathiasgrimm/netwatch) [![Tests](https://camo.githubusercontent.com/8be61ea3c4bc18758f7d1638a59c3937063e8866c0840f3093be2ecf6e2a4f3e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d6174686961736772696d6d2f6e657477617463682f74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/mathiasgrimm/netwatch/actions/workflows/tests.yml) [![Total Downloads](https://camo.githubusercontent.com/6825cad94a43fa59b5d096e41b1271bfdb87736550eeed40f188c0bcb8328859/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6174686961736772696d6d2f6e657477617463682e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mathiasgrimm/netwatch) [![PHP Version](https://camo.githubusercontent.com/e70e81860ddc551491cfe73d81963c2c52b5a17d2642115111b5acfedce672aa/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d254532253839254135382e332d3737374242343f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mathiasgrimm/netwatch) [![License](https://camo.githubusercontent.com/ac049ef4e7a0b7196b09add6ac2d4f180e544c0ac779c2b2ac2fd2723a209579/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75653f7374796c653d666c61742d737175617265)](LICENSE)

When an application feels slow, the first question is always the same: is it the app, or is it the network? Answering it usually means SSH-ing into a box and juggling `ping`, `redis-cli --latency`, `psql`, and `curl` by hand - with no consistent numbers to compare across environments.

Netwatch answers it in one command. It probes each of your services - Redis, MySQL, PostgreSQL, S3, HTTP endpoints, raw TCP - for N iterations, splits every measurement into connect and request time, and reports min/max/avg and p50/p95/p99 percentiles. Run it as a standalone CLI in any PHP project, or drop it into Laravel and get an Artisan command plus a health dashboard preconfigured from your existing `.env`.

 [![Netwatch health dashboard](docs/dashboard-dark.avif)](docs/dashboard-dark.avif)

Features
--------

[](#features)

- **Multiple probe types** - HTTP, TCP/IP, Redis (php-redis), MySQL/PostgreSQL/SQLite (PDO), AWS S3
- **Statistical analysis** - min, max, avg, p50, p95, p99 for connect, request, and total latency
- **Latency thresholds** - per-probe warn/crit limits drive the dashboard, JSON API and CLI alike, with `--fail-on-crit` for cron/CI
- **Parallel execution** - probes run concurrently via subprocesses (default in CLI)
- **Per-probe configuration** - individual iteration counts, enable/disable flags, serializable probe definitions
- **Laravel integration** - service provider with auto-discovery, Artisan command, and health dashboard
- **Standalone CLI** - works with any PHP project via Symfony Console
- **Fail-fast** - stops probing after 3 consecutive failures
- **Custom probes** - implement a single interface to measure anything

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

[](#requirements)

- PHP 8.3+
- `ext-curl` (for HTTP and S3 probes)
- `ext-redis` (for Redis probe, optional)
- `ext-pdo` (for database probes, optional)

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

[](#installation)

```
composer require mathiasgrimm/netwatch
```

Laravel Integration
-------------------

[](#laravel-integration)

Netwatch auto-registers via Laravel package discovery. No manual provider registration needed.

### Install

[](#install)

```
php artisan netwatch:install
```

This publishes the config file and service provider, and registers the provider in `bootstrap/providers.php`.

To overwrite previously published files:

```
php artisan netwatch:install --force
```

You can also publish assets individually:

```
php artisan vendor:publish --tag=netwatch-config
php artisan vendor:publish --tag=netwatch-provider
```

The config file (`config/netwatch.php`) contains pre-configured probes that read from your existing Laravel environment variables (`DB_*`, `REDIS_*`, `AWS_*`, `APP_URL`). The config uses the serializable `[Class::class => [args]]` array format, so it is fully compatible with `php artisan config:cache`.

```
