{"id":14975409,"url":"https://github.com/neography7/laravel-easyresponse","last_synced_at":"2026-02-24T00:38:29.455Z","repository":{"id":177621319,"uuid":"634897161","full_name":"Neography7/Laravel-EasyResponse","owner":"Neography7","description":"Standardized response for Laravel REST APIs with easy usability.","archived":false,"fork":false,"pushed_at":"2023-08-07T22:06:09.000Z","size":44,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-10T18:28:54.168Z","etag":null,"topics":["laravel","laravel10","php","php8"],"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/Neography7.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-05-01T13:48:06.000Z","updated_at":"2023-08-07T22:04:38.000Z","dependencies_parsed_at":"2023-12-16T01:07:12.131Z","dependency_job_id":null,"html_url":"https://github.com/Neography7/Laravel-EasyResponse","commit_stats":null,"previous_names":["neography7/easy-response","neography7/laravel-easyresponse"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neography7%2FLaravel-EasyResponse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neography7%2FLaravel-EasyResponse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neography7%2FLaravel-EasyResponse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neography7%2FLaravel-EasyResponse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Neography7","download_url":"https://codeload.github.com/Neography7/Laravel-EasyResponse/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241061891,"owners_count":19902789,"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":["laravel","laravel10","php","php8"],"created_at":"2024-09-24T13:51:59.377Z","updated_at":"2025-10-30T00:41:17.456Z","avatar_url":"https://github.com/Neography7.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Introduction\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/neography7/easy-response.svg?style=flat-square)](https://packagist.org/packages/neography7/easy-response)\n[![Total Downloads](https://img.shields.io/packagist/dt/neography7/easy-response.svg?style=flat-square)](https://packagist.org/packages/neography7/easy-response)\n![GitHub Actions](https://github.com/neography7/easy-response/actions/workflows/main.yml/badge.svg)\n\nEasy Response allows you to create REST Callbacks in an easy way. This package has 3 ways to create callbacks which you can use what you want. But if it's suitable for you, the helpers will be more easy and clean. \n\nThis package follows PSR-2 and PSR-4 standards.\n\n# Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require neography7/easy-response\n```\n\n# Usage\n\nThere are three ways to use this package but using it with the helpers is recommended. \n\n## 1) Helpers\n\n### easySuccess helper \n\n```php\neasySuccess( message, title = null, data = null);\n```\n\n```php\neasySuccess(\n    message: 'Test message',\n    title: 'Test Title',\n    data: [\n        \"key\" =\u003e \"value\"\n    ]\n);\n```\n\nor like this\n\n```php\neasySuccess('Test message', 'Test Title', [ \"key\" =\u003e \"value\" ]);\n```\n\n### easyError helper \n\n```php\neasyError( message, title = null, code = null, data = null);\n```\n\n```php\neasyError(\n    message: 'Test message',\n    title: 'Test Title',\n    code: 400,\n    data: [\n        \"key\" =\u003e \"value\"\n    ]\n);\n```\n\nor like this\n\n```php\neasyError('Test message', 'Test Title', 400, [ \"key\" =\u003e \"value\" ]);\n```\n\n## 2) Class\n\nFirstly import the class, then create an instance.\n\n```\nuse Neography7\\EasyResponse\\EasyResponse;\n\n$callback = new EasyResponse;\n```\n\nYou can add message, title, success, code, data or add custom key with chaining methods.\n\n```\n$callback-\u003etitle(\"Title\")\n            -\u003emessage(\"Message\")\n            -\u003esuccess(\"true\")\n            -\u003eresponse();\n```\nThe response method is going to make it all together into an array then it responds as a json callback. If success is given as true, the response code will be 200. Additionally, you can add data, code, and custom key-value with the chaining methods.\n\n```\n$callback-\u003etitle(\"Error Title\")\n            -\u003emessage(\"Error message.\")\n            -\u003esuccess(\"false\")\n            -\u003ecode(404)\n            -\u003edata[\"key\" =\u003e value]\n            -\u003eaddKey(\"key\", value)\n            -\u003eresponse();\n```\nIf you want to remove the key that you added, you can use this method.\n\n\n```\n$callback-\u003eremoveKey(\"key\");\n```\n\n## 3) Static Class\n\nFirstly import the class that initializes EasyResponse, then call the success or error method that you want to use.\n\n```\nuse Neography7\\EasyResponse\\EA;\n\n$callbackSuccess = EA::success($message, $title = null);\n$callbackError = EA::error($message, $title = null, $code = null);\n```\n\nYou must to call response method after use.\n\n```\n$callback EA::success(\"Message\", \"Title\")-\u003eresponse();\n```\n\n# Testing\n\nI recommend testbench with \"nunomaduro/collision\" for testing.\n\n```bash\nphp vendor/bin/testbench package:test\n```\n\n# Roadmap\n\n* [x] The package were created\n* [ ] More helpers function will be added\n* [ ] Initial callbacks messages and their translations will be added\n\n# Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n# Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n# Security\n\nIf you discover any security related issues, please email ilkerakyel97@gmail.com instead of using the issue tracker.\n\n# Credits\n\n-   [İlker Akyel](https://github.com/neography7)\n-   [All Contributors](../../contributors)\n\n# License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneography7%2Flaravel-easyresponse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneography7%2Flaravel-easyresponse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneography7%2Flaravel-easyresponse/lists"}