Download the PHP package param-processor/param-processor without Composer

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

ParamProcessor

ParamProcessor is a parameter processing library that provides a way to declaratively define a set of parameters and how they should be processed. It can take such declarations together with a list of raw parameters and provide the processed values. For example, if one defines a parameter to be an integer, in the range [0, 100], then ParamProcessor will verify the input is an integer, in the specified range, and return it as an actual integer variable.

Also see ParserHooks, a library that builds on top of ParamProcessor and provides MediaWiki integration.

Build Status Code Coverage Scrutinizer Code Quality

On Packagist: Latest Stable Version Download count

Installation

The recommended way to use this library is via Composer.

Composer

To add this package as a local, per-project dependency to your project, simply add a dependency on param-processor/param-processor to your project's composer.json file. Here is a minimal example of a composer.json file that just defines a dependency on version 1.x of this package:

Manual

Get the code of this package, either via git, or some other means. Also get all dependencies. You can find a list of the dependencies in the "require" section of the composer.json file. Then take care of autoloading the classes defined in the src directory.

Concept

The goal of the ParamProcessor library is to make parameter handling simple and consistent.

In order to achieve this, a declarative API for defining parameters is provided. Passing in such parameter definitions together with a list of raw input into the processor leads to a processed list of parameters. Processing consists out of name and alias resolving, parsing, validation, formatting and defaulting.

If ones defines an "awesomeness" parameter of type "integer", one can be sure that at the end of the processing, there will be an integer value for the awesomeness parameter. If the user did not provide a value, or provided something that is invalid, while the parameter it is required, processing will abort with a fatal error. If on the other hand there is a default, the default will be set. If the value was invalid, a warning will be kept track of. In case the user provides a valid value, for instance "42" (string), it will be turned in the appropriate 42 (int).

Implementation structure

Parameters are defined using the ParamProcessor\ParamDefinition class. Users can also use the array format to define parameters and not be bound to this class. At present, it is preferred to use this array format as the class itself is not stable yet.

Processing is done via ParamProcessor\Processor.

Defining parameters

Array definition schema

These fields are supported:

Name Type Default Description
name string required
type string (enum) string
default mixed null If this value is null, the parameter has no default and is required
aliases array of string empty array Aliases for the name
trim boolean inherited from processor options If the value should be trimmed
islist boolean false
delimiter string , The delimiter between values if it is a list
manipulatedefault boolean true If the default value should also be manipulated
values array Allowed values
message string required
post-format callback none Takes the value as only parameter and returns the new value

The requires fields currently are: name and message

Core parameter types

Name PHP return type Description
string string Default type
Supported options:
  • length: int or false (overrides minlength and maxlength)
  • minlength: int or false
  • maxlength: int or false
  • regex: string
boolean boolean Accepts "yes", "no", "on", "off", "true" and "false"
float float Supported options:
  • lowerbound: int, float or false
  • upperbound: int, float or false
  • range: [lowerbound, upperbound]
  • withinrange: [float $point, float $deviation]
integer integer Supported options: same as for float
dimension string Value for a width or height attribute in HTML
Supported options:
  • allowauto: bool
  • maxpercentage: int
  • minpercentage: int
  • units: array of string
  • defaultunit: string
  • lowerbound: int, float or false
  • upperbound: int, float or false

Defining parameter types

As an example, the Maps MediaWiki extension defines a coordinate parameter type that turns the input into a DataValues\LatLongValue value object.

Usage example

Defining parameters

Processing input using defined parameters

Alternative way to input parameters:

Contributing

Authors

ParamProcessor has been written by Jeroen De Dauw to support the Maps and Semantic MediaWiki projects.

Release notes

1.12.0 (2021-05-04)

1.11.0 (2021-03-18)

1.10.0 (2019-08-03)

1.9.0 (2019-08-03)

1.8.0 (2019-08-03)

1.7.0 (2019-08-02)

1.6.1 (2019-07-28)

1.6.0 (2019-07-28)

1.5.0 (2019-07-28)

1.4.2 (2018-11-26)

1.4.1 (2018-11-26)

1.4.0 (2018-11-25)

1.3.4 (2018-05-05)

1.3.3 (2017-09-28)

1.3.2 (2017-03-26)

1.3.1 (2016-09-21)

1.3.0 (2016-07-15)

1.2.5 (2016-05-23)

1.2.4 (2016-05-15)

1.2.3 (2016-04-04)

1.2.2 (2014-10-24)

1.2.0 (2014-09-12)

1.1.0 (2014-05-07)

1.0.2 (2013-12-16)

1.0.1 (2013-11-29)

1.0.0 (2013-11-21)

First release as standalone PHP library.

Links


All versions of param-processor with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
data-values/data-values Version ~3.0|~2.0|~1.0
data-values/interfaces Version ~1.0|~0.2.0|~0.1.4
data-values/common Version ~1.0|~0.4.0|~0.3.0
data-values/validators Version ~1.0|~0.1.1
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 param-processor/param-processor contains the following files

Loading the files please wait ....