Giter VIP home page Giter VIP logo

phpgex's Introduction

phpgex

This is a pure and beautiful PHP library implementation for common regex patterns. It's designed with ease of operation, and user-friendly experience. This library will allow you to quickly match some of the contributed patterns. The code is inspired by Laravel framework and the Validator API that Laravel offers. In quite similar approach, this library will be updated reguralry with new, fixed and improved patterns. This library is also inspired (but not limited) by PHPVerbalExpression, SRL and many other. In case you are interested, the Contribution guidelines is several paragraphs bellow.

phpgex in it's simplicity allows you validating input in a sexy manner. The full API documentation is on Wiki of this project located here. The repository is officialy hosted on GitHub!

Simple as this ...

<?php

...
	// return $request->data('email')
	// [email protected]

	if ( $phpgex->isEmail($request->data('email') )
	{
		return Response::200;
	}
...

This README consits of several paragraphs: Download / Install, Usage, Info, Contribution.

Download / Install

This library is open-source and free to use, therefore is licensed under GNU GENERAL PUBLIC LICENSE v3 license also included in this project under the name of LICENSE.

You can use this library by cloning it into your project like:

$ cd myCoolProject
$ mkdir vendor/ && cd vendor/ && git clone [email protected]:dn5/phpgex.git

Usage

Using the phpgex is lovable experince. The example bellow offer you a simple introduction on how to use phpgex. You may aswell check out tests directory which show an example of validation process. The full API documentation is available in the official GitHub wiki page for this project located here.

Preferably, depening on which framework you use, you may aswell define type and object through dependency injection (pseudo bellow):

<service name="mycoolproject" class="Yourcompany\Project\MyCoolProject">
	<argument name="phpgex" type="PhpgexExecutor" />
</service>

In case that the phpgex should be reusable, you can pass it through the construct.

<?php

namespace Yourcompany\Project;

use SomeLibrary;
use Request;
use Stackrecord\External\Library\Phpgex\PhpgexExecutor;

private $phpgex;

class MyCoolProject {

	function __construct(PhpgexExecutor $phpgex)
	{
		$this->phpgex = $phpgex;
	}

	public function postRegistrationAction(Request $request)
	{
		if (!$this->phpgex->isEmail($request->data('email')))
		{
			throw new Exception('Invalid email address!', ...);
		}

		if (!$this->phpgex->isCreditCardNumber($request->data('ccno')))
		{
			throw new Exception('Invalid credit card number!', ...);
		}

		...
	}

}

Info

This library is new and just rolled out. The patterns might have bugs and affect your product or software arhitecture. I'm not responsible for any action that have been made while using this library. If you are interested in joining the project, please follow contribution guide.

Current phpgex API offers these callable methods available in API documentation.

Contribution

This library is build with the help of Debuggex.

phpgex's People

Contributors

duraki avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.