https://github.com/inspector-apm/inspector-laravel
Code Execution Monitoring foe Laravel applications.
https://github.com/inspector-apm/inspector-laravel
inspector laravel lumen middleware monitoring
Last synced: about 1 month ago
JSON representation
Code Execution Monitoring foe Laravel applications.
- Host: GitHub
- URL: https://github.com/inspector-apm/inspector-laravel
- Owner: inspector-apm
- License: mit
- Created: 2019-04-16T15:00:33.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2025-03-07T11:12:04.000Z (3 months ago)
- Last Synced: 2025-04-06T21:09:44.769Z (about 1 month ago)
- Topics: inspector, laravel, lumen, middleware, monitoring
- Language: PHP
- Homepage: https://inspector.dev/laravel?utm_source=github&utm_medium=link&utm_campaign=organic&utm_content=laravel
- Size: 312 KB
- Stars: 218
- Watchers: 4
- Forks: 16
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Inspector | Code Execution Monitoring Tool
[](//packagist.org/packages/inspector-apm/inspector-laravel)
[](https://packagist.org/packages/inspector-apm/inspector-laravel)
[](//packagist.org/packages/inspector-apm/inspector-laravel)
[](code_of_conduct.md)> Before moving on, please consider giving us a GitHub star ⭐️. Thank you!
Code Execution Monitoring for Laravel applications.
- [Requirements](#requirements)
- [Install](#install)
- [Configure the Ingestion Key](#key)
- [Middleware](#middleware)
- [Test everything is working](#test)
- [Official Documentation](https://docs.inspector.dev/guides/laravel)
- [Contribution Guidelines](#contribution)## Requirements
- PHP >= 7.2.0
- Laravel >= 5.5## Install
Install the latest version by:
```
composer require inspector-apm/inspector-laravel
```## For Lumen
If your application is based on Lumen you need to manually register the `InspectorServiceProvider`:```php
$app->register(\Inspector\Laravel\InspectorServiceProvider::class);
```### Configure the Ingestion Key
First put the Ingestion Key in your environment file:
```
INSPECTOR_INGESTION_KEY=[ingestion key]
```You can obtain an `INSPECTOR_INGESTION_KEY` creating a new project in your [Inspector](https://inspector.dev) account.
### Attach the Middleware
To monitor HTTP requests you should attach the `WebMonitoringMiddleware` in your http application route groups.
**Laravel <= 10**
```php
/**
* The application's route middleware groups.
*
* @var array
*/
protected $middlewareGroups = [
'web' => [
...,
\Inspector\Laravel\Middleware\WebRequestMonitoring::class,
],'api' => [
...,
\Inspector\Laravel\Middleware\WebRequestMonitoring::class,
]
];
```**Laravel >= 11**
```php
use \Inspector\Laravel\Middleware\WebRequestMonitoring;return Application::configure(basePath: dirname(__DIR__))
->withMiddleware(function (Middleware $middleware) {
// Append the middleware
$middleware->appendToGroup('web', WebRequestMonitoring::class)
->appendToGroup('api', WebRequestMonitoring::class);
})
->create();
```### Test everything is working
Run the command below:
```
php artisan inspector:test
```Go to [https://app.inspector.dev](https://app.inspector.dev) to explore your data.
## Official documentation
**[Check out the official documentation](https://docs.inspector.dev/guides/laravel/installation)**
## Contributing
We encourage you to contribute to Inspector! Please check out the [Contribution Guidelines](CONTRIBUTING.md) about how to proceed. Join us!
## LICENSE
This package is licensed under the [MIT](LICENSE) license.