{"id":20254230,"url":"https://github.com/fumeapp/metapi","last_synced_at":"2025-04-10T23:50:48.684Z","repository":{"id":32899581,"uuid":"145353427","full_name":"fumeapp/metapi","owner":"fumeapp","description":"Laravel API helpers including benchmarking and interactive browsing","archived":false,"fork":false,"pushed_at":"2025-02-19T00:08:33.000Z","size":443,"stargazers_count":28,"open_issues_count":1,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-30T13:03:40.390Z","etag":null,"topics":["api","json","jsonapi","jsonp","laravel","laravel-package","pretty-print"],"latest_commit_sha":null,"homepage":"","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/fumeapp.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-20T01:54:39.000Z","updated_at":"2025-02-19T00:08:13.000Z","dependencies_parsed_at":"2024-04-25T06:52:32.933Z","dependency_job_id":null,"html_url":"https://github.com/fumeapp/metapi","commit_stats":{"total_commits":94,"total_committers":3,"mean_commits":"31.333333333333332","dds":0.06382978723404253,"last_synced_commit":"52c544da76c36c44798669dba4a2ccf5a3a00945"},"previous_names":[],"tags_count":51,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumeapp%2Fmetapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumeapp%2Fmetapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumeapp%2Fmetapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumeapp%2Fmetapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fumeapp","download_url":"https://codeload.github.com/fumeapp/metapi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248317707,"owners_count":21083528,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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","json","jsonapi","jsonp","laravel","laravel-package","pretty-print"],"created_at":"2024-11-14T10:30:57.510Z","updated_at":"2025-04-10T23:50:48.665Z","avatar_url":"https://github.com/fumeapp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/acidjazz/metapi/raw/master/logo.png\"/\u003e\n\u003c/p\u003e\n\n\u003e Own your endpoint\n\nmetapi's main purpose is to help make sure your endpoint responses are consistent.  By using the built in helper functions like `-\u003eoption()...-\u003everify`, `-\u003erender()`, `-\u003esuccess()` and `-\u003eerror()` they will all share the same consistent standardized output reflecting the options available, parameters provided, and results.\n\n[![Latest Stable Version](https://poser.pugx.org/acidjazz/metapi/version.png)](https://packagist.org/packages/acidjazz/metapi)\n[![Total Downloads](https://poser.pugx.org/acidjazz/metapi/d/total.png)](https://packagist.org/packages/acidjazz/metapi)\n[![codecov](https://codecov.io/gh/acidjazz/metapi/branch/master/graph/badge.svg)](https://codecov.io/gh/acidjazz/metapi)\n\n\u003cimg src=\"https://github.com/acidjazz/metapi/blob/master/media/capture.png?raw=true\"/\u003e\n\n\u003e Dracula dark theme with laravel-debugbar\n\n\n\n## Features\n* Endpoint benchmarking\n* Laravel Validation wrapper that reflects requirements\n* Support for JSON and JSONP\n* Interactive tree browsing with search thanks to [jsoneditor](https://github.com/josdejong/jsoneditor)\n* Dracula Dark theme support to pair with [laravel-debugbar](https://github.com/barryvdh/laravel-debugbar)\n\n\n## Installation\n\nInstall metapi with [composer](https://getcomposer.org/doc/00-intro.md):\n```bash\ncomposer require acidjazz/metapi\n```\n\nAdd the trait\n\u003e (`app/Http/Controllers/Controller.php` is recommended)\n```php\n\u003c?php\n\nuse acidjazz\\metapi\\MetApi;\nclass Controller\n{\n    use Metapi;\n```\n\n## Examples\n\n```php\n\u003c?php\n\nnamespace App\\Http\\Controllers;\n\nuse acidjazz\\metapi\\MetApi;\n\nclass OrgController extends Controller\n{\n\n  use MetApi;\n\n    /**\n    * Display a listing of the resource.\n    *\n    * @return \\Illuminate\\Http\\Response\n    */\n    public function index(Request $request)\n    {\n        $this\n          -\u003eoption('approved', 'nullable|boolean');\n          -\u003eoption('type', 'nullable|in:this,that');\n          -\u003everify();\n        ...\n        $this-\u003erender($results);\n```\n\n`GET /endpoint?approved=1`\n\n```json\n{\n    \"benchmark\": 0.011060953140258789,\n    \"query\": {\n        \"defaults\": [],\n        \"options\": {\n            \"approved\": \"nullable|boolean\",\n            \"type\": \"nullable|in:this,that\"\n        },\n        \"params\": {\n            \"approved\": \"1\"\n        },\n        \"combined\": {\n            \"approved\": \"1\"\n        }\n    },\n    \"data\": [\n        {\n```\n\n`GET /endpoint?callback=bob`\n\n```js\nbob({\n    \"benchmark\": 0.011017084121704102,\n    \"query\": {\n        \"defaults\": [],\n        \"options\": {\n            \"approved\": \"nullable|boolean\",\n            \"type\": \"nullable|in:this,that\"\n        },\n        \"params\": [],\n        \"combined\": []\n    },\n    \"data\": [\n        {\n```\n\n**Add [custom attributes](https://laravel.com/docs/9.x/validation#specifying-custom-attribute-values) to validation.**\n\n```php\n    public function send(Request $request)\n    {\n        $this-\u003eoption('contact.email', 'required|email', [], 'Email Address')\n            -\u003eoption('contact.name', 'required|string', [], 'Firstname')\n            -\u003eoption('contact.surname', 'required|string', [], 'Lastname')\n            -\u003everify();\n        ...\n        $this-\u003erender($results);\n    }\n```\n\n`POST /send`\n\n```json\n{\n    \"status\": \"error\",\n    \"errors\": [\n        {\n            \"status\": 400,\n            \"message\": \"contact.email\",\n            \"detail\": \"Email Address is a required field.\"\n        },\n        {\n            \"status\": 400,\n            \"message\": \"contact.name\",\n            \"detail\": \"Firstname is a required field.\"\n        },\n        {\n            \"status\": 400,\n            \"message\": \"contact.surname\",\n            \"detail\": \"Lastname is a required field.\"\n        }\n    ]\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffumeapp%2Fmetapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffumeapp%2Fmetapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffumeapp%2Fmetapi/lists"}