Download the PHP package tequilarapido/api-response without Composer

On this page you can find all versions of the php package tequilarapido/api-response. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package api-response

A simple way to return well formatted json responses in a Laravel application.

Latest Version on Packagist Build Status StyleCI Quality Score Code Coverage

Laravel Translation Sheet

Installation

You can install the package using composer

Add the service provider

Usage

This package comes with a helper function api_response(), as sugar syntax to using app(Tequilarapido\ApiResponse\ApiResponse::class)

Return a response from an item (Array / Associative array / Object/)

Result :

Return a response from a collection

Result :

Return a response from a paginated collection

Result :

Transformers

You can use transformers along with item(), collection(), and paginatedCollection methods to transform results before returning the responses.

To learn more about the concept behind transformers, please read the League\Fractal documentation.

Put in a simple way, a Transformer class

Let's assume that we need to return an api response containing a collection of books retreived from database, and we want to format/enhance/restrict results.

Result:

Attaching cookies

For item(), collection(), and paginatedCollection methods the returned result is a built Illuminate\Http\Response object.

To be able to attach cookies you need to instruct api_response() methods to not build the response by setting the $built argument to false, attach the cookie and then build the response.

Attaching headers

For item(), collection(), and paginatedCollection methods the returned result is a built Illuminate\Http\Response object.

To be able to attach headers you need to instruct api_response() methods to not build the response by setting the $built argument to false, attach the header and then build the response.

Other useful methods

Method Usage
api_response()->noContent() Return an empty response with 204 No Content header.
api_response()->errorNotFound() Return a 404 Not found.
api_response()->errorBadRequest() Return a 404 Bad Request.
api_response()->errorForbidden() Return a 403 Forbidden.
api_response()->errorUnAUthorized() Return a 401 Unauthorized.
api_response()->errorInternal() Return a 500 Internal Error.
api_response()->error() Return a more customizable error (Accept MessageBag instance, staus code ...)

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

Security

If you discover any security related issues, please email :author_email instead of using the issue tracker.

Contributing

Please see CONTRIBUTING for details.

Credits

License

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


All versions of api-response with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1.3
laravel/framework Version ~5.8.0|^6.0|^7.0
league/fractal Version ^0.14.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package tequilarapido/api-response contains the following files

Loading the files please wait ....