Download the PHP package jason-gao/http without Composer

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

Nette HTTP Component

Downloads this Month Build Status Build Status Windows Coverage Status Latest Stable Version License

Introduction

HTTP request and response are encapsulated in Nette\Http\Request and Nette\Http\Response objects which offer comfortable API and also act as sanitization filter.

Documentation can be found on the website.

Installation

The recommended way to install is via Composer:

It requires PHP version 5.6 and supports PHP up to 7.2. The dev-master version requires PHP 7.1.

HTTP Request

Nette cleans out data sent by user from control and invalid characters.

The URL of the request is available as [api:Nette\Http\UrlScript] instance:

Determine current HTTP method:

Is the connection encrypted (HTTPS)?

Is this an AJAX request?

What is the user's IP address?

What URL the user came from? Returned as [Nette\Http\Url |urls] object.

Request parameters:

Uploaded files are encapsulated into [api:Nette\Http\FileUpload] objects:

HTTP headers are also accessible:

A useful method is detectLanguage(). You can pass it an array with languages supported by application and it returns the one preferred by browser. It is not magic, the method just uses the Accept-Language header.

RequestFactory and URL filtering

Object holding current HTTP request is created by [api:Nette\Http\RequestFactory]. Its behavior can be modified. It's possible to clean up URLs from characters that can get into them because of poorly implemented comment systems on various other websites by using filters:

And then we let the factory generate a new httpRequest and we store it in a system container:

HTTP response

Whether it is still possible to send headers or change the status code tells the isSent() method. If it returns true, it won't be possible to send another header or change the status code.

In that case, any attempt to send header or change code invokes Nette\InvalidStateException. .[caution]

[Response status code | http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10] can be sent and retrieved this way:

For better source code readability it is recommended to use predefined constants instead of actual numbers:

Method setContentType($type, $charset=null) changes Content-Type response header:

Redirection to another URL is done by redirect($url, $code=302) method. Do not forget to terminate the script afterwards!

To set the document expiration date, we can use setExpiration() method. The parameter is either text data, number of seconds or a timestamp:

Now we send the HTTP response header:

Sent headers are also available:

There are two methods for cookie manipulation: setCookie() and deleteCookie().

These two methods can take more parameters: $path (subdirectory where the cookie will be available), $domain and $secure. Their detailed description can be found in PHP manual for [php:setcookie] function.


All versions of http with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.0
nette/utils Version ^2.4 || ~3.0.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 jason-gao/http contains the following files

Loading the files please wait ....