Download the PHP package suomec/ovalidator without Composer

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

PHP object mapper and schema validator (PHP version >= 8.1)

This package created for mapping user input to pre-defined objects with validation schema (custom rules).

Usually you have user input as array and need to map/validate it to your value-objects. This package can help you.

First, you need a Form - class, that contains user raw data. It's /src/Form.php class.

Second, you need an object, with internal properties. It's just an instance of your class.

Third, you need a set of rules to map input to that class. It's a Config. Rules are set of ->add() methods

And the last - some code for validation and map

If you have an input: ['field_2' => 15] it's correct and $input->field_2 will have a value of 15. But for input ['field_2' => 999] $result variable will contain a list of errors (VMax check fails, because 999 > 20).

Installation

Run: composer require suomec/ovalidator

Validators

Builtin validator are described in validators.md file. You can create own validator which should implement Validator interface.

Setters

Setters are special objects which map validated input to your object. There are two default setters - Direct and Reflection-based. First setter just apply input to object via $object->$property without extended checks. Second setter checks types of properties via reflection and supported interfaces if property is another object.

Localization

Localization files are located in /etc/ folder. There is a class for quick validation run: OValidator::validateAndSet() It creates localization object from default file loc-en.php. You can pass path to your own file if needed.

Examples

You can find more examples at the /examples/ dir. There are a lot of different cases where that mapper and validator can be used. Fell free to create issue for any questions or improvements.


All versions of ovalidator with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
ext-json Version *
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 suomec/ovalidator contains the following files

Loading the files please wait ....