PHPackages                             doriven/insert-data-validator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. doriven/insert-data-validator

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

doriven/insert-data-validator
=============================

Validation data before insert to database

06PHP

Since May 26Pushed 9y ago1 watchersCompare

[ Source](https://github.com/d0riven/InsertDataValidator)[ Packagist](https://packagist.org/packages/doriven/insert-data-validator)[ RSS](/packages/doriven-insert-data-validator/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)DependenciesVersions (1)Used By (0)

doriven/InsertDataValidator
===========================

[](#doriveninsertdatavalidator)

This library frees engineers from the task of creating trivial validation of database table definitions.

**This library only support MySQL** (but we plan to support other databases from Version 1)

Installation
------------

[](#installation)

```
$ php composer.phar require doriven/insert-data-validator

```

Usage
-----

[](#usage)

The definition of the `user` table in MySQL is as follows:

```
+----------------+---------------------+------+-----+-------------------+----------------+
| Field          | Type                | Null | Key | Default           | Extra          |
+----------------+---------------------+------+-----+-------------------+----------------+
| id             | int(11)             | NO   | PRI | NULL              | auto_increment |
| age            | tinyint(3) unsigned | YES  |     | NULL              |                |
| email          | varchar(64)         | YES  |     | NULL              |                |
| name           | varchar(32)         | YES  |     | NULL              |                |
| password       | varchar(64)         | YES  |     | NULL              |                |
| reminder_token | varchar(64)         | YES  |     | NULL              |                |
| created_at     | datetime            | YES  |     | NULL              |                |
| updated_at     | timestamp           | NO   |     | CURRENT_TIMESTAMP |                |
+----------------+---------------------+------+-----+-------------------+----------------+
```

You use this library as follows if you insert data to table name of a `user` in program.

```
