{"id":49549546,"url":"https://github.com/gradints/laravel-benchmark-route","last_synced_at":"2026-05-02T21:32:21.715Z","repository":{"id":352803129,"uuid":"1216628096","full_name":"gradints/laravel-benchmark-route","owner":"gradints","description":"Adds elapsed time to HTTP response.","archived":false,"fork":false,"pushed_at":"2026-04-21T06:59:34.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-21T08:34:57.882Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gradints.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-21T04:56:14.000Z","updated_at":"2026-04-21T06:55:03.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/gradints/laravel-benchmark-route","commit_stats":null,"previous_names":["gradints/laravel-benchmark-route"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/gradints/laravel-benchmark-route","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gradints%2Flaravel-benchmark-route","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gradints%2Flaravel-benchmark-route/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gradints%2Flaravel-benchmark-route/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gradints%2Flaravel-benchmark-route/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gradints","download_url":"https://codeload.github.com/gradints/laravel-benchmark-route/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gradints%2Flaravel-benchmark-route/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32550901,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-02T21:31:48.061Z","status":"ssl_error","status_checked_at":"2026-05-02T21:31:46.574Z","response_time":132,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":[],"created_at":"2026-05-02T21:32:21.117Z","updated_at":"2026-05-02T21:32:21.710Z","avatar_url":"https://github.com/gradints.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gradints/laravel-benchmark-route\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/gradints/laravel-benchmark-route.svg?style=flat-square)](https://packagist.org/packages/gradints/laravel-benchmark-route)\n\nThis package provides a middleware that adds the elapsed time of a controller action to the response headers. It is designed to be used in Laravel applications and can be easily integrated into your existing routes.\n\n## Installation\n\nYou can install the package via Composer:\n\n```bash\ncomposer require --dev gradints/laravel-benchmark-route\n```\n\nAfter installing it, you need to register the middleware in your bootstrap/app.php file:\n\n```php\nuse Gradin\\LaravelBenchmarkRoute\\Middleware\\BenchmarkMiddleware;\nuse Illuminate\\Foundation\\Application;\nuse Illuminate\\Foundation\\Configuration\\Exceptions;\nuse Illuminate\\Foundation\\Configuration\\Middleware;\nuse Sentry\\Laravel\\Integration;\n\nreturn Application::configure(basePath: dirname(__DIR__))\n    -\u003ewithRouting(\n        web: __DIR__.'/../routes/web.php',\n        api: __DIR__.'/../routes/api.php',\n        commands: __DIR__.'/../routes/console.php',\n        channels: __DIR__.'/../routes/channels.php',\n        health: '/up',\n        apiPrefix: '',\n    )\n    -\u003ewithMiddleware(function (Middleware $middleware): void {\n        if (class_exists(BenchmarkMiddleware::class)) {\n            // register BenchmarkMiddleware for web and api routes\n            $middleware-\u003eweb(BenchmarkMiddleware::class);\n            $middleware-\u003eapi(BenchmarkMiddleware::class);\n        }\n    });\n```\n\n## Usage\n\n```php\nuse Gradin\\LaravelBenchmarkRoute\\Attributes\\Benchmark;\nuse Illuminate\\Http\\Resources\\Json\\JsonResource;\n\nclass ProductController extends Controller\n{\n    #[Benchmark]\n    public function index()\n    {\n        $products = Product::paginate(20);\n\n        return JsonResource::collection($products);\n    }\n}\n```\n\nAnd the response will be like this:\n\n```json\n{\n  \"data\": [\n    // products\n  ],\n  \"meta\": {\n    // pagination meta data\n  },\n  \"benchmark\": {\n    \"time\": \"1,230.93\"\n  }\n}\n```\n\nYou can also give boolean as an argument to enable or disable the benchmark\n\n```php\n#[Benchmark(true)]\n#[Benchmark(false)]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgradints%2Flaravel-benchmark-route","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgradints%2Flaravel-benchmark-route","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgradints%2Flaravel-benchmark-route/lists"}