Download the PHP package mivir/pupil without Composer

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

Pupil

An easy and powerful string-based validation library.

This is Pupil.php, the PHP version of the library.

Other available versions:

Features

Changelog

Installation

Via Composer

Add "mivir/pupil": "1.*" to the "require" section of composer.json.

Via downloading

Download the repository. Point a PSR-0 autoloader at the src folder or require the files manually.

Usage

The basic syntax is this:

Where $rules and $values are arrays with matching keys. The rules are specified as rule strings; more information on those below.

For example:

The two arrays don't have to have identical keys, but values without a matching key in rules won't be evaluated at all.

The validate() method returns an object that has the following methods:

Rule strings

Rule strings are Pupil's primary method of specifying validation rules.

The syntax aims to mimic C-like languages. You can use logical operators (&& (and), || (or), ! (not)), ternaries (condition ? thenRule : elseRule), nested "blocks" (rule && (some || nested || rules)) and validation functions (validationFunction("arg1", "arg2")).

String parameters for validation functions, such as the regex in the "regex" function, should be quoted.
Non-quoted parameters will be cast to floats (numbers with decimals).

For each validation function, there is also a matching function prepended by other that allows you to run functions on other values than the one the rule string is for. This can be useful for fields that have differing requirements depending on another field. For example:

Validation function arguments can be either strings or numerical values. Numerical arguments should not be wrapped in quotation marks or apostrophes: .

Validation functions

The following functions are available by default:

Adding custom functions

You can use the following syntax to add your own validation functions:

Where callable is either an anonymous function or one created with create_function and should, at the very least, accept two arguments: $allValues and $value. $allValues is an object containing every value that's being validated at the moment while $value contains the value we're validating at the moment. Further arguments can be passed in rule strings like so:

The function names are case-insensitive.


All versions of pupil with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.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 mivir/pupil contains the following files

Loading the files please wait ....