miladev / api-response
A simple Laravel package for success and fail response traits.
1.0
2023-08-10 11:56 UTC
Requires
- php: >=5.4.0
This package is auto-updated.
Last update: 2025-01-10 15:50:16 UTC
README
Laravel Api Response
Features
- Simple API Response
Requirements
- Laravel 5+
Installation
api-response is available via Composer
$ composer require miladev/api-response
Usage
<?php namespace App\Http\Controllers; use Miladev\ApiResponse\ApiResponse; class TestController extends Controller { use ApiResponse; public function successResponseTest() { $data = [ 'name' => 'milad', 'job' => 'dev' ]; return $this->successResponse(data: $data,statusCode: 201); } public function failResponseTest() { return $this->failResponse(message: "Not found",statusCode: 404); } }