Download the PHP package joomla/input without Composer

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

The Input Package Build Status

Latest Stable Version Total Downloads Latest Unstable Version License

This package comprises of four classes, Input\Inputand several sub-classes extended from it: Input\Cookie, Input\Files, and Input\Json. An input object is generally owned by the application and explicitly added to an application class as a public property, such as can be found in Application\AbstractApplication.

The intent of this package is to abstract out the input source to allow code to be reused in different applications and in different contexts through dependency injection. For example, a controller could inspect the request variables directly using JRequest. But suppose there is a requirement to add a web service that carries input as a JSON payload. Instead of writing a second controller to handle the different input source, it would be much easier to inject an input object that is tailored for the type of input source, into the controller.

Using a Input\Input object through dependency injection also makes code easier to test.

Input\Input

Construction

Unlike its predecessor JRequest which is used statically, the Input\Input class is meant to be used as an instantiated concrete class. Among other things, this makes testing of the class, and the classes that are coupled to it, easier, but also means the developer has a lot more flexibility since this allows for dependency injection.

The constructor takes two optional array arguments. The first is the source data which defaults to a copy of the superglobal $_REQUEST if omitted or null. The second is a general options array for which "filter" is the only option key currently supported. If omitted, Input\Input will just use the default instance of Filter\Input.

Usage

The most common usage of the Input\Input class will be through the get method which is roughly equivalent to the old JRequest::getVar method. The get method takes three arguments: a key name, a default value and a filter name (defaulting to "cmd" if omitted). The filter name is any valid filter type that the Filter\Input class, or the custom class provided in the constructor, supports.

The set method is also equivalent to JRequest::setVar as is the getMethod method.

The filter types available when using Filter\InputFilter are:

If no filter type is specified, the default handling of Filter\Input is to return an aggressively cleaned and trimmed string, stripped of any HTML or encoded characters.

Additionally, magic getters are available as shortcuts to specific filter types.

The class also supports a magic get method that allows you shortcut access to other superglobals such as $_POST, etc, but returning them as a Input\Input object.

Serialization

The Input\Input class implements the Serializable interface so that it can be safely serialized and unserialized. Note that when serializing the "ENV" and "SERVER" inputs are removed from the class as they may conflict or inappropriately overwrite settings during unserialization. This allows for Input\Input objects to be safely used with cached data.

Input\Cookie

Can you help improve this section of the README?

Input\Files

The Input\Files class provides a way to handle file attachments as payloads of POSTed forms. Consider the following form which is assumed to handle an array of files to be attached (through some JavaScript behavior):

Access the files from the request could be done as follows:

Unlike the PHP $_FILES supergobal, this array is very easier to parse. The example above assumes two files were submitted, but only one was specified. The 'blank' file contains an error code (see PHP file upload errors).

The set method is disabled in Input\Files.

Input\Json

Can you help improve this section of the README?

Mocking the Input Package

For simple cases where you only need to mock the Input\Input class, the following snippet can be used:

Changes From 1.x

The following changes have been made to the Input package since 1.x.

Pass By Reference

Input, Input\Cookie, and Input\Files all use the source superglobal by reference in 1.x. In 2.0, the reference is removed.

Installation via Composer

Add "joomla/input": "~2.0" to the require block in your composer.json and then run composer install.

Alternatively, you can simply run the following from the command line:

If you want to include the test sources, use


All versions of input with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1.0
joomla/filter Version ^3.0
symfony/deprecation-contracts Version ^2|^3
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 joomla/input contains the following files

Loading the files please wait ....