LaravelPackages.net
Acme Inc.
Toggle sidebar
danjamesmills/laravel-response

A Laravel package to standardise and simplify API responses, providing consistent structure and helper utilities for success, error, and data responses.

3.801
1
1.0.4
About danjamesmills/laravel-response

danjamesmills/laravel-response is a Laravel package for a laravel package to standardise and simplify api responses, providing consistent structure and helper utilities for success, error, and data responses.. It currently has 1 GitHub stars and 3.801 downloads on Packagist (latest version 1.0.4). Install it with composer require danjamesmills/laravel-response. Discover more Laravel packages by danjamesmills or browse all Laravel packages to compare alternatives.

Last updated

Laravel Response

Latest Version on Packagist Total Downloads GitHub Actions

Introducing the Simple API Response Package for Laravel - a lightweight package that allows you to easily extend the functionality of your API's BaseController. This package provides simple helper methods for returning response codes and data. The methods include "sendResponse", "sendError" and "sendSuccess" which helps to return JSON responses with appropriate status codes and messages. With this package, you can streamline your API's response handling and ensure consistency throughout your application. This package is easy to use, and it can help you to keep your code clean and well-organized. The package is built with flexibility in mind, and it can easily adapt to your application's specific needs.

Installation

You can install the package via composer:

composer require danjamesmills/laravel-response

Usage

<?php

namespace App\Http\Controllers\Api;

use DanJamesMills\LaravelResponse\Http\Controllers\BaseController;

class PostAPIController extends AppBaseController
{
    public function store(PollAPIRequest $request)
    {
        return $this->sendResponse($poll->toArray(), 'Poll saved successfully');
    }
    
    public function destroy($id)
    {
        return $this->sendSuccess('Poll deleted successfully');
    }
}

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Comments