{"id":19188767,"url":"https://github.com/miquido/request-data-collector","last_synced_at":"2026-04-28T17:01:52.946Z","repository":{"id":50936328,"uuid":"177816108","full_name":"miquido/request-data-collector","owner":"miquido","description":"The project was made by Miquido. https://www.miquido.com/","archived":false,"fork":false,"pushed_at":"2021-10-18T11:06:12.000Z","size":83,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-25T03:22:57.212Z","etag":null,"topics":["laravel","monitoring","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/miquido.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-26T15:24:01.000Z","updated_at":"2024-12-16T06:27:44.000Z","dependencies_parsed_at":"2022-08-25T12:01:43.758Z","dependency_job_id":null,"html_url":"https://github.com/miquido/request-data-collector","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/miquido/request-data-collector","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miquido%2Frequest-data-collector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miquido%2Frequest-data-collector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miquido%2Frequest-data-collector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miquido%2Frequest-data-collector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/miquido","download_url":"https://codeload.github.com/miquido/request-data-collector/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miquido%2Frequest-data-collector/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32390067,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T14:34:11.604Z","status":"ssl_error","status_checked_at":"2026-04-28T14:32:37.009Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["laravel","monitoring","php"],"created_at":"2024-11-09T11:25:57.547Z","updated_at":"2026-04-28T17:01:52.929Z","avatar_url":"https://github.com/miquido.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Requests Data Collector\n\nWith this package one can easily start collecting various data that comes through Laravel. It is possible to gain control over excessive database queries and more by analyzing logs.\n\nThis package aims to work as a zero-configuration. Although there are default configurations for existing data collectors, take your time to adjust them to own needs. Also, feel free to add own data collectors.\n\nWhen using this package, every handled request (i.e. not excluded according to `exclusions` rules) will contain `X-Request-Id` header in the response. You can use this ID to correlate various collectors' data.\n\n[![GitHub license](https://img.shields.io/badge/license-Apache2.0-brightgreen.svg)](https://github.com/miquido/request-data-collector/blob/master/LICENSE)\n[![Build](https://github.com/miquido/request-data-collector/workflows/PHP/badge.svg?branch=master)](https://github.com/miquido/request-data-collector/actions?query=branch%3Amaster)\n\n\n## Set up\n\n### Laravel 5.6+\nIf You are not using auto-discovery feature, register package's service provider in `config/app.php` file:\n\n```php\n\t'providers' =\u003e [\n\t\t// ...\n\t\t\\Miquido\\RequestDataCollector\\Providers\\LaravelServiceProvider::class,\n\t],\n```\n\n### Lumen\n\nRegister package's service provider in `bootstrap/app.php` file:\n\n```php\n$app-\u003eregister(\\Miquido\\RequestDataCollector\\Providers\\LumenServiceProvider::class);\n``` \n\nIf You want to override default configuration, don't forget to copy the default one to `/config/request-data-collector.php` file and load it in `bootstrap/app.php` file:\n\n```php\n$app-\u003econfigure('request-data-collector');\n```\n\n### Further configuration\n\nAdd new environment variable (e.g. to `.env` file):\n\n```ini\nREQUESTS_DATA_COLLECTOR_ENABLED=true\n```\n\nThat's it! By default, only basic information about requests are collected and pushed to logs (according to `LOG_CHANNEL` channel).\n\n### Publishing default configuration\n\n```bash\nphp artisan vendor:publish --provider=\"Miquido\\RequestDataCollector\\Providers\\LaravelServiceProvider\"\n```\n\n## Available Data Collectors\n\nThere are some predefined Data Collectors that might be used.\n\n### RequestResponseCollector\n\nThis collector is used to collect data about the incoming request and ongoing response.\n\n```php\n'request' =\u003e [\n\t'driver' =\u003e \\Miquido\\RequestDataCollector\\Collectors\\RequestResponseCollector::class,\n\n\t'request_info' =\u003e [\n\t\t// ...\n\t],\n\n\t'response_info' =\u003e [\n\t\t// ...\n\t],\n\n\t'variables' =\u003e [\n\t\t// ...\n\t],\n\n\t'raw' =\u003e boolean,\n],\n```\n\n#### request_info\n\nDefines a list of request parameters that should be collected. For list of available options, see `\\Miquido\\RequestDataCollector\\Collectors\\RequestResponseCollector::REQUEST_INFO_*` constants.\n\nExample:\n\n```php\n'request_info' =\u003e [\n\t\\Miquido\\RequestDataCollector\\Collectors\\RequestResponseCollector::REQUEST_INFO_REAL_METHOD,\n\t\\Miquido\\RequestDataCollector\\Collectors\\RequestResponseCollector::REQUEST_INFO_PATH_INFO,\n],\n```\n\n#### response_info\n\nDefines a list of response parameters that should be collected. For list of available options, see `\\Miquido\\RequestDataCollector\\Collectors\\RequestResponseCollector::RESPONSE_INFO_*` constants.\n\nExample:\n\n```php\n'response_info' =\u003e [\n\t\\Miquido\\RequestDataCollector\\Collectors\\RequestResponseCollector::RESPONSE_INFO_HTTP_STATUS_CODE,\n],\n```\n\n#### variables\n\nDefines a list of variables associated with request that should be collected. For list of available options, see `\\Miquido\\RequestDataCollector\\Collectors\\RequestResponseCollector::VARIABLE_*` constants.\n\nIt is possible to collect all information about variable:\n\n```php\n'variables' =\u003e [\n\t\\Miquido\\RequestDataCollector\\Collectors\\RequestResponseCollector::VARIABLE_GET,\n],\n```\n\nOr include/exclude some of them (which is especially useful when dealing with sensitive data):\n\n```php\n// Incoming request: /some/page?email=...\u0026password=...\n\n'variables' =\u003e [\n\t\\Miquido\\RequestDataCollector\\Collectors\\RequestResponseCollector::VARIABLE_GET =\u003e [\n\t\t'excludes' =\u003e [\n\t\t\t'password',\n\t\t],\n\t\t\n\t\t'includes' =\u003e [\n\t\t\t'email',\n\t\t],\n\t],\n],\n```\n\nIt is worth mentioning, that **inclusions have priority over exclusions**. This means if inclusions are used, exclusions are not applied at all.\n\n#### raw\n\nWhen set to `true`, request will be remembered as soon as reaches application (allows to have unmodified request).\nWhen set to `false`, data collection will use request at the end of application lifetime (allows to include request modifications).\n\nPlease note that raw request does not have routing information, so `\\Miquido\\RequestDataCollector\\Collectors\\RequestResponseCollector::REQUEST_INFO_ROUTE` option will not have effect.\n\n### DatabaseQueriesCollector\n\nThis collector is used to collect data about performed database queries.\n\nPlease note, that it uses Laravel's built-in `\\DB::enable/disable/flushQueryLog()` methods, so if it is also used somewhere else in the code, it might have impact on the final result.\n\n```php\n'database' =\u003e [\n\t'driver' =\u003e \\Miquido\\RequestDataCollector\\Collectors\\DatabaseQueriesCollector::class,\n\n\t'connections' =\u003e [\n\t\t// ...\n\t],\n],\n```\n\n#### connections\n\nDefines a list of connections to databases from which queries should be collected. Use names defined in `config/database.php` file. It is also possible to provide `null` value as a name to collect queries from default connection.\n\n## Enabling or disabling Data Collectors\n\nEach collector's configuration consists of two parts: entry in `collectors` array and entry in `options` array.\n\nThe `collectors` array contains key-value entries, where key is collector name and value is either `true` or `false`, depending on if it should be enabled or disabled. Suggestion: if it is required to dynamically enable/disable specified collectors, one might want to define different environmental variables for each collector itself (e.g. `DATABASE_COLLECTOR_ENABLED` etc.).\n\nThe `options` array contains key-value entries, where key is collector name and value is an array with its configuration. It is required for it to have at least `driver` setting. Every other settings are collector dependent.\n\nThe `key` with collector name will be used for logging purposes. Every log entry contains information about request ID and given collector name to easier find/filter it.\n\n## Excluding requests from collecting\n\nIt is possible to exclude some requests that should not be collected at all.\n\n```php\n'exclude' =\u003e [\n\t[\n\t\t'filter' =\u003e class reference,\n\t\t'with'   =\u003e [\n\t\t\t// ...\n\t\t],\n\t],\n\t\n\t// ...\n],\n```\n\nEach entry consists of:\n\n**filter** containing filter class reference (e.g. `\\Miquido\\RequestDataCollector\\Filters\\UserAgentFilter::class`).\n\n**with** containing data provided for filter class constructor (e.g. `'userAgents' =\u003e ['Docker HEALTHCHECK'], ...`). Note: Laravel's container is used here so it is possible to make use of Dependency Injection.\n\nFeel fre to use one of available filters (see `src/Filters` directory) or write your own.\n\n## Tracking the request through many services\n\nYou can track request through many services. When `Request ID` is being generated, it is firstly checked if there is `X-REQUEST-ID` header present in the request, and its value is being used instead. This way You can see same `Request ID` in logs.\n\nWhen there is no `X-REQUEST-ID` header available, You can still set Your custom `Request ID` via `\\Miquido\\RequestDataCollector\\RequestDataCollector::setRequestId()` method.\n\nIn both cases `Request ID` has to be in following format:\n\n`X[0-9a-fA-F]{32}`\n\nIf `X-REQUEST-ID` has invalid format it will be silently skipped and new ID will be generated.\n\nBy default, tracking is enabled. However, it can be disabled:\n\n```ini\nREQUESTS_DATA_COLLECTOR_ALLOW_TRACKING=false\n```\n\n## About\n\nThe project was made by Miquido: https://www.miquido.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiquido%2Frequest-data-collector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiquido%2Frequest-data-collector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiquido%2Frequest-data-collector/lists"}