Download the PHP package fastpress/request without Composer

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

Fastpress HTTP Request

This repository contains the Request class, a crucial component of the fastpress/framework. The Request class provides a comprehensive interface for handling HTTP requests in PHP applications. It simplifies accessing request data such as GET, POST, COOKIE, and SERVER variables, and includes methods for common request operations.

Features

Installation

To use this component, first ensure you have fastpress/framework installed. This Request class is a dependency of the framework and is meant to be used within its context.

If you are managing your project with Composer, you can add this dependency directly by running:

Ensure that this aligns with the version constraints of fastpress/framework.

Usage

To use the Request class, create an instance of it in your PHP application:

Methods

validateCsrf(): bool

Validates the CSRF token.

Returns: The generated CSRF token.

input(string $key, mixed $default = null, bool $sanitize = true): mixed

Retrieves an input value from GET, POST, or JSON data.

$key: The input key. $default: Optional. The default value to return if the key is not found. $sanitize: Optional. Whether to sanitize the value. Defaults to true. Returns: The input value.

file(string $key): ?array

Retrieves an uploaded file.

$key: The file key. Returns: An array containing file information, or null if the file is not found.

Checks if an uploaded file exists and was uploaded successfully.

$key: The file key. Returns: true if the file exists and was uploaded successfully, false otherwise.

isJson(): bool

Checks if the request content type is JSON.

Returns: true if the content type is JSON, false otherwise. getMethod(): string Gets the HTTP request method.

Returns: The HTTP request method. getIp(): ?string Gets the client's IP address.

Returns: The client's IP address, or null if it cannot be determined. accepts(string $contentType): bool Checks if the client accepts the given content type.

$contentType: The content type to check. Returns: true if the client accepts the content type, false otherwise. header(string $key, mixed $default = null): mixed Retrieves a header value.

PHP $authToken = $request->header('Authorization');



$key: The header key.
$default: Optional. The default value to return if the header is not found.
Returns: The header value.
get(string $key, mixed $default = null): mixed
Retrieves a GET parameter.

$key: The GET parameter key.
$default: Optional. The default value to return if the key is not found.
Returns: The GET parameter value.
post(string $key, mixed $default = null): mixed
Retrieves a POST parameter.

$key: The POST parameter key.
$default: Optional. The default value to return if the key is not found.
Returns: The POST parameter value.
json(string $key, mixed $default = null): mixed
Retrieves a value from the parsed JSON request body.

$key: The JSON key.
$default: Optional. The default value to return if the key is not found.
Returns: The JSON value.
getBody(): string
Gets the raw request body.

Returns: The raw request body.
validate(array $rules): array
Validates the request data against the given rules.

$rules: An array of validation rules.
Returns: An array of validation errors.
setUrlParams(array $params): void
Sets the URL parameters.

$params: An array of URL parameters.
param(string $key, mixed $default = null): mixed
Retrieves a URL parameter.

$key: The URL parameter key.
$default: Optional. The default value to return if the key is not found.
Returns: The URL parameter value.
all(): array
Gets all input data (GET, POST, JSON).

Returns: An array containing all input data.

All versions of request with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.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 fastpress/request contains the following files

Loading the files please wait ....