Download the PHP package genai/validation without Composer

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

genai/validation

Attribute-based validation, compiled to a reflection-free validator — the same build-time pattern as genai/dto / genai/sql-mapper.

Define a form

The #[...] lines are build-only (comments on PHP 5.3).

Public or private fields. Public properties are read directly. A private/ protected field is read through a getXxx()/isXxx() getter (auto-detected at compile; a private field without one is a build error) — same approach as #[Dto]. Note the runtime still has to populate the form, so a private field also needs a setter or constructor; public props are the least ceremony.

Use it

bind() only touches declared fields (no mass-assignment of stray request keys) and is reflection-free (it uses the same compiled field map as validate()). Put trimming/normalization in the form's setters and it runs automatically on bind. Inject GenAI\Validation\Validator — it's auto-wired (the package's bundle provides the bean as the compiled Cache\Validation). One first message per field.

Constraints

Attribute Checks
#[NotBlank] not null / not empty (after trim)
#[Email] valid email
#[Length(min, max)] string length in range (either bound optional)
#[Pattern('/regex/')] matches a PCRE regex
#[Matches('otherField')] equals another field (e.g. password confirm)

All except #[NotBlank] pass an empty value, so combine #[NotBlank] #[Email] to both require and format-check. Every constraint takes an optional message: to override the default.

How it compiles

ValidationProcessor reads each #[Validate] class's property constraints (matched via the Constraint base + IS_INSTANCEOF) and bakes a rule table into Cache\Validation extends GenAI\Validation\Validator. At runtime the Validator reads the form's public props and walks that table with a type switch — no reflection. Cache\Validation is always generated (empty when no forms), so the bean always resolves.


All versions of validation 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 genai/validation contains the following files

Loading the files please wait ...