{"id":44299289,"url":"https://github.com/mlanin/laravel-api-debugger","last_synced_at":"2026-02-11T01:38:06.163Z","repository":{"id":34757371,"uuid":"38738626","full_name":"mlanin/laravel-api-debugger","owner":"mlanin","description":"Easy debug for your JSON API.","archived":false,"fork":false,"pushed_at":"2025-02-27T15:54:52.000Z","size":69,"stargazers_count":233,"open_issues_count":10,"forks_count":57,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-09-08T22:11:38.827Z","etag":null,"topics":["api","debug","laravel","rest"],"latest_commit_sha":null,"homepage":"http://blog.lanin.me/easy-debug-for-your-json-api/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mlanin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-08T07:23:42.000Z","updated_at":"2025-06-18T22:01:26.000Z","dependencies_parsed_at":"2023-01-15T08:59:55.728Z","dependency_job_id":null,"html_url":"https://github.com/mlanin/laravel-api-debugger","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/mlanin/laravel-api-debugger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlanin%2Flaravel-api-debugger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlanin%2Flaravel-api-debugger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlanin%2Flaravel-api-debugger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlanin%2Flaravel-api-debugger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mlanin","download_url":"https://codeload.github.com/mlanin/laravel-api-debugger/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlanin%2Flaravel-api-debugger/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29324578,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-11T00:34:26.354Z","status":"ssl_error","status_checked_at":"2026-02-11T00:34:09.494Z","response_time":65,"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":["api","debug","laravel","rest"],"created_at":"2026-02-11T01:38:03.892Z","updated_at":"2026-02-11T01:38:06.149Z","avatar_url":"https://github.com/mlanin.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel-API-Debugger\n[![Travis](https://img.shields.io/travis/rust-lang/rust.svg)](https://travis-ci.org/mlanin/laravel-api-debugger)\n\n\u003e Easily debug your JSON API.\n\nWhen you are developing JSON API sometimes you need to debug it, but if you will use `dd()` or `var_dump()` you will break the output that will affect every client that is working with your API at the moment. Debugger is made to provide you with all your debug information and not corrupt the output.\n\n```json\n{\n  \"posts\": [\n    {\n      \"id\": 1,\n      \"title\": \"Title 1\",\n      \"body\": \"Body 1\"\n    },\n    {\n      \"id\": 2,\n      \"title\": \"Title 2\",\n      \"body\": \"Body 2\"\n    }\n  ],\n  \"meta\": {\n    \"total\": 2\n  },\n  \"debug\": {\n    \"database\": {\n      \"total\": 2,\n      \"items\": [\n        {\n          \"connection\": \"accounts\",\n          \"query\": \"select * from `users` where `email` = 'john.doe@acme.com' limit 1;\",\n          \"time\": 0.38\n        },\n        {\n          \"connection\": \"posts\",\n          \"query\": \"select * from `posts` where `author` = '1';\",\n          \"time\": 1.34\n        }\n      ]\n    },\n    \"dump\": [\n      \"foo\",\n      [\n        1,\n        2,\n        \"bar\"\n      ]\n    ]\n  }\n}\n```\n\n## Installation\n\n\u003e This help is for Laravel 5.4 only. Readme for earlier versions can be found in the relevant branches of this repo.\n\n[PHP](https://php.net) \u003e=5.5.9+ or [HHVM](http://hhvm.com) 3.3+, [Composer](https://getcomposer.org) and [Laravel](http://laravel.com) 5.4+ are required.\n\nTo get the latest version of Laravel Laravel-API-Debugger, simply add the following line to the require block of your `composer.json` file.\n\nFor PHP \u003e= 7.1:\n\n```\n\"lanin/laravel-api-debugger\": \"^4.0\"\n```\n\nFor PHP \u003c 7.1:\n\n```\n\"lanin/laravel-api-debugger\": \"^3.0\"\n```\n\nYou'll then need to run `composer install` or `composer update` to download it and have the autoloader updated.\n\nOnce Laravel-API-Debugger is installed, you need to register the service provider. Open up `config/app.php` and add the following to the providers key.\n\nFor Laravel 5.4\n```php\nLanin\\Laravel\\ApiDebugger\\ServiceProvider::class,\n```\n\nAlso you can register a Facade for easier access to the Debugger methods.\n\nFor Laravel 5.4\n```php\n'Debugger' =\u003e Lanin\\Laravel\\ApiDebugger\\Facade::class,\n```\n\nFor Laravel 5.5 package supports [package discovery](https://laravel.com/docs/5.5/packages#package-discovery) feature.\n\nCopy the config file to your own project by running the following command:\n```php\nphp artisan vendor:publish --provider=\"Lanin\\Laravel\\ApiDebugger\\ServiceProvider\"\n```\n\n## Json response\n\nBefore extension will populate your answer it will try to distinguish if it is a json response. It will do it by validating if it is a JsonResponse instance. The best way to do it is to return `response()-\u003ejson();` in your controller's method.\n\nAlso please be careful with what you return. As if your answer will not be wrapped in any kind of `data` attribute (`pages` in the example above), frontend could be damaged because of waiting the particular set of attributes but it will return extra `debug` one.\n\nSo the best way to return your responses is like this\n```php\n$data = [\n    'foo' =\u003e 'bar',\n    'baz' =\u003e 1,\n];\n\nreturn response()-\u003ejson([\n    'data' =\u003e [\n        'foo' =\u003e 'bar',\n        'baz' =\u003e 1,\n    ],\n]);\n```\n\nFor more info about better practices in JSON APIs you can find here http://jsonapi.org/\n\n## Debugging\n\nDebugger's two main tasks are to dump variables and collect anny additional info about your request.\n\n### Var dump\n\nDebugger provides you with the easy way to dump any variable you want right in your JSON answer. This functionality sometimes very handy when you have to urgently debug your production environment.\n\n```php\n$foo = 'foo';\n$bar = [1, 2, 'bar'];\n\n// As a helper\nlad($foo, $bar);\n\n// or as a facade\n\\Debugger::dump($foo, $bar);\n```\n\nYou can simultaneously dump as many vars as you want and they will appear in the answer.\n\n**Note!** Of course it it not the best way do debug your production environment, but sometimes it is the only way.\nSo be careful with this, because everyone will see your output, but at least debug will not break your clients.\n\n### Collecting data\n\n**Note!** By default Debugger will collect data ONLY when you set `APP_DEBUG=true`.\nSo you don't have to worry that someone will see your system data on production.\nYou can overwrite that by adding `API_DEBUGGER_ENABLED=true|false` to your .env file, or by changing the value of `enabled` in the config file.\n\nAll available collections can be found in `api-debugger.php` config that you can publish and update as you wish.\n\n#### QueriesCollection\n\nThis collections listens to all queries events and logs them in `connections`, `query`, `time` structure.\n\n#### CacheCollection\n\nIt can show you cache hits, misses, writes and forgets.\n\n#### ProfilingCollection\n\nIt allows you to measure time taken to perform actions in your code.\nThere are 2 ways to do it.\n\nAutomatically:\n\n```php\nDebugger::profileMe('event-name', function () {\n    sleep(1);\n});\n```\n\nOr manually:\n\n```php\nDebugger::startProfiling('event-name');\nusleep(300);\nDebugger::stopProfiling('event-name');\n```\n\nAlso helpers are available:\n```php\nlad_pr_start();\nlad_pr_stop();\nlad_pr_me();\n```\n\n### Extending\n\nYou can easily add your own data collections to debug output.\nJust look at how it was done in the package itself and repeat for anything you want (for example HTTP requests).\n\n## Contributing\n\nPlease feel free to fork this package and contribute by submitting a pull request to enhance the functionalities.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlanin%2Flaravel-api-debugger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmlanin%2Flaravel-api-debugger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlanin%2Flaravel-api-debugger/lists"}