Download the PHP package maplephp/validate without Composer

On this page you can find all versions of the php package maplephp/validate. 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?
maplephp/validate
Rate from 1 - 5
Rated 5.00 based on 1 reviews

Informations about the package validate

MaplePHP - Validation

MaplePHP - Validation is a lightweight and powerful PHP library designed to simplify the validation of various data inputs. Whether you're verifying if a value is a valid email or phone number, ensuring string lengths, or performing more advanced checks like credit card numbers and dates, MaplePHP - Validation offers a comprehensive and intuitive approach. With its wide range of built-in validators and simple syntax, it makes handling complex validation tasks easier, leading to cleaner and more reliable code.


Installation

Install the library via Composer:


Getting Started

You can validate values by instantiating the Validator class. There are two ways to do this:


Validating Nested Data

You can traverse nested arrays or objects and validate specific values using dot notation:

💡 You can also use validateInData() for more dynamic validations:


Using the Chain validations

The ValidationChain class allows you to chain multiple validations on a single value and check the overall result:

🧠 ValidationChain is useful when you want to collect and evaluate multiple validation rules at once.

Validations

Required field

Check if there is any value (even if it's 0)

Check string length (min, max)

Check if string has an exact length

Check if value equals exactly to or not equals another value

Validate if it's a valid email

Validate if it's a valid phone number

Allows numbers and special characters ("-", "+", " ").

Validate Swedish personal number (personnel)

Validate Swedish organization number

Validate credit card number

Validate VAT number

Check if value is a valid float

Check if value is a valid integer

Check if value is a valid number (numeric)

Check if value is positive or negative

Check if value is a valid version number

Compare version with another version

Validate password (lossy or strict)

Validate if value is string and contains only A-Z

Check if it's a valid hex color code

Check if it's a valid date

As default you can validate against a date format like this "Y-m-d"

Custom date validation

Check if it's a valid date and time

Check if it's a valid time

Validate hour and minutes

Validate hour, minutes and seconds

Check if someone is at least a certain age

Check if it's a valid domain name

Check if it's a valid URL (http/https is required)

Check if it's a valid DNS entry

Validate file and directory properties

Validate ZIP code (with custom length)

Validate if value matches a pattern (regex)

Validate Arrays

Check if is an array

Check if array is empty

Strict data type validation check if value exists in given array

Flexible data type validation check if value exists in given array

Strict data type validation check if key exists in array

Check if all items in array is truthy

Check if truthy item exist in array

Check if array count is equal to length

Check if array count is more than the length

Check if array count is less than the length

Check if value is a valid float

Validate types

Check if value is a valid float

Check if value is a valid float

Check if value is a valid integer

HTTP status code validation

Strict data type validation check if value is a valid HTTP status code

Strict data type validation check if value is HTTP 200 OK

Strict data type validation check if value is a 2xx success HTTP code

Strict data type validation check if value is a 4xx client error HTTP code

Strict data type validation check if value is a 5xx server error HTTP code

Validate using multiple methods (one or all must match)


All versions of validate with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
maplephp/dto Version ^3.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 maplephp/validate contains the following files

Loading the files please wait ...