Download the PHP package dejan7/httpquest without Composer

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

Build Status Coverage Status

HTTPQuest

HTTPQuest is a lightweight PHP polyfill that can parse incoming request body for any HTTP verb.

The problem:

PHP by default parses request data only for GET and POST requests and puts them in well-known $_GET and $_POST and $_FILES variables. Additionally it does so only for multipart/form-data and application/x-www-form-urlencoded enctypes (Content-type HTTP header).

So if you are trying to build a REST API in plain PHP (without a framework) which utilizes other HTTP verbs like PUT or PATCH - it turns out to be a pain. This package attempts to solve that by doing the boring parsing for you and making the request data available for any type of request as well.

How to install?

composer require dejan7/httpquest:0.3.0

How to use?

Instantiate the class and call the decode method somewhere near the beginning of your app (e.g. during bootstrapping).

And that's all, your parsed data will now be in variables that you passed to the decode method ($_POST, and $_FILES in this case).

PHP puts stuff in $_POST and $_FILES by default for following cases:

HTTPQuest enhances this and you can configure it to parse data for any method/content-type combination. The default options are set to this:

However, you can change the defaults by passing a HTTPQuestOptions instance to the constructor like this:

Wait! Are you telling me that it can parse request body even for GET requests? That's correct. Now whether you will utilize such scenarios - i leave the choice to you. You can read some of the discussions on StackOverflow and decide for yourself http://stackoverflow.com/questions/978061/http-get-with-request-body http://stackoverflow.com/questions/299628/is-an-entity-body-allowed-for-an-http-delete-request

Files

HTTPQuest also parses the files from incoming requests and tries it's best to mimic PHP's default behavior with $_FILES. However, the only caveat is that you can't use move_uploaded_file PHP function on requests other than POST. On other requests move_uploaded_file thinks that the file wasn't uploaded with PHP and it doesn't execute. The workaround is to use copy like this:

Credits

Russel for sndsgd/http, HTTPQuest uses his multipart/form-data decoding logic.

License

This is an open-sourced software licensed under the MIT license.


All versions of httpquest with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.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 dejan7/httpquest contains the following files

Loading the files please wait ...