Skip to content

Releases: okriiza/laravel-api-response-formatter

v1.2.0

12 Sep 14:47
Compare
Choose a tag to compare

Change Name Class

for example :

- return ApiResponseFormatter::success($user);
+ return ApiResponse::success($user);

v1.1.1

22 May 19:25
Compare
Choose a tag to compare

Bug Fix:

  • fix response

v1.1.0

22 May 19:01
Compare
Choose a tag to compare

Release Note: Laravel API Response Formatter v1.1.0

We are thrilled to announce the release of Laravel API Response Formatter v1.1.0! This version brings exciting new features and enhancements to further enhance the formatting of API responses in Laravel applications.

New Features and Enhancements:

  • Addition of Response Functions: We have expanded the capabilities of the API Response Formatter class by introducing new response functions:
    • created: Format a success response for resource creation with customizable data, messages, and HTTP status codes.
    • noContent: Format a success response with no content, commonly used for successful deletion or empty responses.
    • unAuthenticated: Format an error response for unauthenticated requests, providing an appropriate status code and message.
    • forbidden: Format an error response for forbidden requests, indicating access is denied with an appropriate status code and message.
    • notFound: Format an error response for resource not found scenarios, specifying the relevant status code and message.
    • methodNotAllowed: Format an error response for requests with unsupported HTTP methods, indicating the allowed methods and providing an appropriate status code and message.
    • failedValidation: Format an error response for failed validation scenarios, including the validation errors, status code, and message.

Expanded Functionality:

  • Enhanced Error Response Formatting: The error response function now allows specifying custom messages, status codes, and data to provide more context and flexibility in error handling.

Updated Example Usage:

// Format a success response for resource creation
return ApiResponseFormatter::created($data);

// Format a success response with no content
return ApiResponseFormatter::noContent();

// Format an error response for unauthenticated requests
return ApiResponseFormatter::unAuthenticated(null, 'Authentication failed');

// Format an error response for forbidden requests
return ApiResponseFormatter::forbidden(null, 'Access denied');

// Format an error response for resource not found
return ApiResponseFormatter::notFound(null, 'Resource not found');

// Format an error response for unsupported HTTP method
return ApiResponseFormatter::methodNotAllowed(null, 'Method not allowed');

// Format an error response for failed validation
return ApiResponseFormatter::failedValidation($validationErrors);

We are confident that these new additions will further streamline your API development process, enhance response consistency, and improve error handling. Your feedback and suggestions are always welcome as we continue to refine and improve the Laravel API Response Formatter.

Thank you for your continued support and trust in Laravel API Response Formatter!

  • The Laravel API Response Formatter Team

v1.0.0 Released

20 Mar 03:26
Compare
Choose a tag to compare

We are excited to announce the release of Laravel API Response Formatter v1.0.0!

Laravel API Response Formatter is a PHP package that provides a simple way to format your API responses. It helps you to easily standardize your API responses, making it easier for developers to understand and use your API.

This release includes the following features:

  • ApiResponseFormatter class for formatting API responses
  • success() method for successful API responses
  • error() method for error API responses
  • Unit tests for testing the package

To install Laravel API Response Formatter, simply run the following command in your Laravel project:

composer require okriiza/laravel-api-formatter

We hope this package will help you to improve your API development experience. If you have any questions or feedback, please feel free to submit an issue on our GitHub repository.

Thank you for using Laravel API Response Formatter!