<commit_before># php-filter
A type validate &amp; filter plugin for PHP projects

[![Latest Stable Version](https://poser.pugx.org/taobig/php-filter/v/stable)](https://packagist.org/packages/taobig/php-filter)
[![Latest Unstable Version](https://poser.pugx.org/taobig/php-filter/v/unstable)](https://packagist.org/packages/taobig/php-filter)
[![Total Downloads](https://poser.pugx.org/taobig/php-filter/downloads)](https://packagist.org/packages/taobig/php-filter)
[![License](https://poser.pugx.org/taobig/php-filter/license)](https://packagist.org/packages/taobig/php-filter)
[![Build Status](https://travis-ci.org/taobig/php-filter.svg?branch=master)](https://travis-ci.org/taobig/php-filter)
[![Coverage Status](https://coveralls.io/repos/github/taobig/php-filter/badge.svg)](https://coveralls.io/github/taobig/php-filter)

### INSTALLATION
**Install via Composer**  
If you do not have Composer, you may install it refer to [getcomposer.org](https://getcomposer.org/download/).

You can then install this project template using the following command:
```
php composer.phar require taobig/php-filter

```

## Usage
```
$validator = new taobig\filter\filters\TypeValidator();
$validator->isString("hello world");//return true
$validator->isString(1111.32333, false);//return true
$validator->isInt(1111);//return true
$validator->isInt("1111", false);//return true
$validator->isIntList([1111]);//return true
$validator->isIntList(["1111"], false);//return true
$validator->isStringList(["1111"]);//return true
$validator->isStringList([1111], false);//return true

$filter = new taobig\filter\filters\TypeFilter(['exceptionMessage'=>'parameters type error']);
$filter->stringVal("hello world");//return "hello world"
$filter->stringVal(1111.32333, false);//return "1111.32333"
$filter->intVal("1111", false);//return 1111

$validator = new taobig\filter\validators\MobileValidator();  
$validator->isChineseMobile("13800001111");//return true


-----------------------------------

use taobig\filter\helpers\StringHelper;
StringHelper::startsWith("hello world", "h");//true
StringHelper::startsWith("hello world", "");//true
StringHelper::startsWith("hello world", "H");//false<commit_msg>update usage<commit_after># php-filter
A type validate &amp; filter plugin for PHP projects

[![Latest Stable Version](https://poser.pugx.org/taobig/php-filter/v/stable)](https://packagist.org/packages/taobig/php-filter)
[![Latest Unstable Version](https://poser.pugx.org/taobig/php-filter/v/unstable)](https://packagist.org/packages/taobig/php-filter)
[![Total Downloads](https://poser.pugx.org/taobig/php-filter/downloads)](https://packagist.org/packages/taobig/php-filter)
[![License](https://poser.pugx.org/taobig/php-filter/license)](https://packagist.org/packages/taobig/php-filter)
[![Build Status](https://travis-ci.org/taobig/php-filter.svg?branch=master)](https://travis-ci.org/taobig/php-filter)
[![Coverage Status](https://coveralls.io/repos/github/taobig/php-filter/badge.svg)](https://coveralls.io/github/taobig/php-filter)

### INSTALLATION
**Install via Composer**  
If you do not have Composer, you may install it refer to [getcomposer.org](https://getcomposer.org/download/).

You can then install this project template using the following command:
```
php composer.phar require taobig/php-filter

```

## Usage
```
use taobig\filter\filters\TypeValidator;
TypeValidator::isString("hello world");//return true
TypeValidator::isString(1111.32333, false);//return true
TypeValidator::isInt(1111);//return true
TypeValidator::isInt("1111", false);//return true
TypeValidator::isIntList([1111]);//return true
TypeValidator::isIntList(["1111"], false);//return true
TypeValidator::isStringList(["1111"]);//return true
TypeValidator::isStringList([1111], false);//return true


$filter = new taobig\filter\filters\TypeFilter(['exceptionMessage'=>'parameters type error']);
$filter->stringVal("hello world");//return "hello world"
$filter->stringVal(1111.32333, false);//return "1111.32333"
$filter->intVal("1111", false);//return 1111

use taobig\filter\filters\MobileValidator;  
TypeValidator::isChineseMobile("13800001111");//return true


-----------------------------------

use taobig\filter\helpers\StringHelper;
StringHelper::startsWith("hello world", "h");//true
StringHelper::startsWith("hello world", "");//true
StringHelper::startsWith("hello world", "H");//false
{'fraction_non_alphanumeric': 0.19794520547945205, 'fraction_numerical': 0.0319634703196347, 'mean_word_length': 5.719325153374233, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 20, 'https://': 26, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '695275', 'n_tokens_mistral': 1518, 'n_tokens_neox': 1411, 'n_words': 222}