Download the PHP package emyoutis/whitehouse-responder without Composer

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

WhiteHouse Responder

This package provides some tools to generate API responses based on the White House Standards in PHP.

Installation

Usage

Making Objects

Registering Errors

Based on the White House Standards, every error code should points to an error entity. In the WhiteHouse Responder, you can register your errors and their information in an ErrorsRepository class to use them after that.

Unregistering Errors

It is a common problem that you need to unregister an error after registering it. You can do that with the code below.

Making Failure Responses

Given that in the White House Standards failure responses should return 400 or 500 responses. So that the we have two usable methods to return errors with these statuses.

After that, we also have another method to be used when you want to specify the status manually.

Replacements

You can place some replaceable phrases in the errors info while registering it, to make their contents dynamic. The replaceable phrases should start with a :.

The returning value will be:

Omitting Error Exception

By default, the errors repository throws exceptions on registering a previously registered error code and requesting for a non-existing error code. But you can disable throwing these exceptions with the code below.

Making Success Responses

As the White House Standards says, the success responses must contain two parts; results and metadata. These parts can be passed to a success() method to generate a success response.

Key Formatter

You can register a closure to be used to format all the keys which are being generated by the package. For example, if we have a snake_case() function to map strings to the snake-case format, we can have the below code.

The returning result of this code will be:

:bulb: Changing the keys may take your responses out of the WhiteHouse Standards.


All versions of whitehouse-responder with dependencies

PHP Build Version
Package Version
Requires php Version >=7.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 emyoutis/whitehouse-responder contains the following files

Loading the files please wait ....