Download the PHP package femastudios/http-utils without Composer
On this page you can find all versions of the php package femastudios/http-utils. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download femastudios/http-utils
More information about femastudios/http-utils
Files in femastudios/http-utils
Download femastudios/http-utils
More information about femastudios/http-utils
Files in femastudios/http-utils
Vendor femastudios
Package http-utils
Short Description PHP collection of enums and basic utilities for HTTP
License GPL-3.0-only
Package http-utils
Short Description PHP collection of enums and basic utilities for HTTP
License GPL-3.0-only
Please rate this library. Is it a good library?
Informations about the package http-utils
http-utils
This library is a very simple collection of a few classes to facilitate handling HTTP requests.
Installation
Available as composer package femastudios/http-utils
. PHP 7.3 or greater required.
Contents & Usage
Core
Very base classes. Enumerators are declared using the femastudios/enums library.
HttpRequestMethod
: enumerator that defines the common request methods (GET
,POST
, etc.). They also have some properties (e.g. is cachable)HttpResponseCode
: enumerator that defines the common response codes (SUCCESS
,NOT_FOUND
,FORBIDDEN
, etc.). They have the numerical code and the standard message.HttpResponseCodeType
: enumerator that defines the type of a response code (i.e.INFORMATIONAL
,SUCCESSFUL
,REDIRECTION
,CLIENT_ERROR
andSERVER_ERROR
)HttpException
: exception class that wraps anHttpResponseCode
enum, useful to bubble up an HTTP response code that need to be handled at a higher level.
Header utils
These utilities allow to better handle request and response HTTP headers.
RequestHeaderUtils
: contains functions to read the headers sent by the requester (even in a context that does not definegetallheaders()
, like FPM).ResponseHeaderUtils
: contains functions to add and read headers to be sent, also with support of comma-separated values (that can be added in different calls).
Example usage:
Uploaded files utils
Here we have utilities that help handling file uploads. The main reason for this utility is:
- Handle the errors with an exception;
- Untangle the mess that is the
$_FILES
array when the param name is nested (e.g.user[info][avatar]
). For more on this see the doc ofUploadedFilesUtils::getReorderedFiles()
.
The classes are:
UploadedFile
: class that contains the info on a single uploaded file (e.g. name, size, etc.)UploadedFileException
: exception thrown when an error uploading a file is detected. It cotains the error code and a description of the error as message.UploadedFilesUtils
: contains static functions to retrieve the uploaded files
Example usage:
All versions of http-utils with dependencies
PHP Build Version
Package Version
The package femastudios/http-utils contains the following files
Loading the files please wait ....