Download the PHP package willywes/apiresponse without Composer

On this page you can find all versions of the php package willywes/apiresponse. 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 apiresponse

ApiResponse

Latest Version on Packagist Total Downloads StyleCI

Class to generate a standard structure for api json responses.

Installation

Via Composer

Usage

Imports

Functions of Control (HTTP/200 OK)

Default functions that always return a http 200 code, but have a control state.

Params

Param Description
data array of data for response (allow null)
message custom message to response (optional)
title custom title to response (optional)

Functions

Function Description
JsonSuccess Response status "success" with HTTP 200
JsonError Response status "error" with HTTP 200
JsonWarning Response status "warning" with HTTP 200
JsonInfo Response status "info" with HTTP 200
JsonFieldValidation Response status "field_validation" with HTTP 200
JsonFieldValidationError Response status "field_validation" with HTTP 422

Examples

Success example
Error example

Functions with specific HTTP Code

Default functions that returns a specific http code, but in the same way the body responds

Params

Param Description
data array of data for response (allow null)
message custom message to response (optional)

Functions Code HTTP 1XX

Http Code Function Name Description
100 Http100 or Continue Response status "info" with HTTP 100
101 Http101 or SwitchingProtocols Response status "info" with HTTP 101
102 Http102 or Processing Response status "info" with HTTP 102
103 Http103 or EarlyHints Response status "info" with HTTP 103

Functions Code HTTP 2XX

Http Code Function Name Description
200 Http200 or Ok Response status "success" with HTTP 200
201 Http201 or Created Response status "success" with HTTP 201
202 Http202 or Accepted Response status "success" with HTTP 202
203 Http203 or NonAuthoritativeInformation Response status "success" with HTTP 203
204 Http204 or NoContent Response status "success" with HTTP 204
205 Http205 or ResetContent Response status "success" with HTTP 205
206 Http206 or PartialContent Response status "success" with HTTP 206

Functions Code HTTP 3XX

Http Code Function Name Description
300 Http300 or MultipleChoices Response status "redirection" with HTTP 300
301 Http301 or MovedPermanently Response status "redirection" with HTTP 301
302 Http302 or MovedTemporarily Response status "redirection" with HTTP 302
303 Http303 or SeeOther Response status "redirection" with HTTP 303
304 Http304 or NotModified Response status "redirection" with HTTP 304
305 Http305 or UseProxy Response status "redirection" with HTTP 305
307 Http307 or TemporaryRedirect Response status "redirection" with HTTP 307
308 Http308 or PermanentRedirect Response status "redirection" with HTTP 308

Functions Code HTTP 4XX

Http Code Function Name Description
400 Http400 or BadRequest Response status "error" with HTTP 400
401 Http401 or Unauthorized Response status "error" with HTTP 401
402 Http402 or PaymentRequired Response status "error" with HTTP 402
403 Http403 or Forbidden Response status "error" with HTTP 403
404 Http404 or NotFound Response status "error" with HTTP 404
405 Http405 or MethodNotAllowed Response status "error" with HTTP 405
406 Http406 or NotAcceptable Response status "error" with HTTP 406
407 Http407 or ProxyAuthenticationRequired Response status "error" with HTTP 407
408 Http408 or RequestTimeout Response status "error" with HTTP 408
409 Http409 or Conflict Response status "error" with HTTP 409
410 Http410 or Gone Response status "error" with HTTP 410
411 Http411 or LengthRequired Response status "error" with HTTP 411
412 Http412 or PreconditionFailed Response status "error" with HTTP 412
413 Http413 or RequestEntityTooLarge Response status "error" with HTTP 413
414 Http414 or RequestUriTooLarge Response status "error" with HTTP 414
415 Http415 or UnsupportedMediaType Response status "error" with HTTP 415
416 Http416 or RequestedRangeNotSatisfiable Response status "error" with HTTP 416
417 Http417 or ExpectationFailed Response status "error" with HTTP 417
421 Http421 or MissDirectedRequest Response status "error" with HTTP 421
422 Http422 or UnprocessableEntity Response status "error" with HTTP 422
423 Http423 or Locked Response status "error" with HTTP 423
424 Http424 or FailedDependency Response status "error" with HTTP 424
426 Http426 or UpgradeRequired Response status "error" with HTTP 426
428 Http428 or PreconditionRequired Response status "error" with HTTP 428
429 Http429 or TooManyRequests Response status "error" with HTTP 429
431 Http431 or RequestHeaderFieldsTooLarge Response status "error" with HTTP 431
451 Http451 or UnavailableForLegalReasons Response status "error" with HTTP 451

Functions Code HTTP 5XX

Http Code Function Name Description
500 Http500 or InternalServerError Response status "error" with HTTP 500
501 Http501 or NotImplemented Response status "error" with HTTP 501
502 Http502 or BadGateway Response status "error" with HTTP 502
503 Http503 or ServiceUnavailable Response status "error" with HTTP 503
504 Http504 or GatewayTimeout Response status "error" with HTTP 504
505 Http505 or HTTPVersionNotSupported Response status "error" with HTTP 505
506 Http506 or VariantAlsoNegotiates Response status "error" with HTTP 506
507 Http507 or InsufficientStorage Response status "error" with HTTP 507
508 Http508 or LoopDetected Response status "error" with HTTP 508
510 Http510 or NotExtended Response status "error" with HTTP 510
511 Http511 or NetworkAuthenticationRequired Response status "error" with HTTP 511

Examples

404 Error example
401 Error example
403 Error example

Credits

License

license. Please see the license file for more information.


All versions of apiresponse with dependencies

PHP Build Version
Package Version
Requires illuminate/support Version ~5|~6|~7|~8|~9|~10
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 willywes/apiresponse contains the following files

Loading the files please wait ....