flyandi/is 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

flyandi/is

Composer 安装命令:

composer require flyandi/is

包简介

A collection of useful is conditions.

README 文档

README

Is for PHP is a small library that provides some handy methods to quickly check or validate the contents of a variable.

Install it

Install the library via composer:

composer install flyandi/is

How to use it

Pretty straightforward. The library exposes the static class Is that contains all the evaluating methods, e.g.:

$AnArray = ['red', 'blue', green];

$AnColor = '#00FF00';

if(Is::_array($AnArray)) echo "Yes, it's an array!";

if(Is::hexcolor($AnColor)) echo "This is a valid color code.";

Methods

The Is library implements the following methods currently:

Method Description
iterable Checks if an object can be iterated, e.g. forEach
fn Returns true if the argument is an function
object Returns true if the argument is an object
array Returns true if the argument is an array
string Returns true if the argument is an string
number Returns true if the argument is an number
boolean Returns true if the argument is an "true" boolean, e.g. TRUE or FALSE
defined Returns true if the argument is defined, e.g. not undefined
empty Returns true if the argument is really empty
same Returns true if two arguments are equal, e.g. Is.same('1', '1');
associated Returns true if the argument is an associated array
sequential Returns true if the argument is an sequential array

Additionally the library also provides some basic validation expression filters:

Method Description
url Returns true if the argument contains a URL
email Returns true if the argument contains an E-Mail
creditcard Returns true if the argument contains an Credit Card Number
alphanumeric Returns true if the argument contains an Alpha Numeric string
time Returns true if the argument contains an time
datestring Returns true if the argument contains an date string
zip Returns true if the argument contains an ZIP Code
phone Returns true if the argument contains a US Phone Number
ssn Returns true if the argument contains a Social Security Number
affirmative Returns true if the argument contains True, Yes or Ok
hexadecimal Returns true if the argument contains a hexadecimal string
hexcolor Returns true if the argument contains an HTML color

Other Implementations

This library was originally written in JavaScript for Meteor (http://github.com/flyandi/meteor-is) and implements the same methods and filters.

统计信息

  • 总下载量: 19.09k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-10-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固