Skip to content

Commit 10cd031

Browse files
committed
Improved description in README
1 parent 42d0731 commit 10cd031

File tree

1 file changed

+53
-1
lines changed

1 file changed

+53
-1
lines changed

README.md

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,57 @@
11
# php-simple-regex
22

3+
What is it
4+
----------
5+
36
PhpSimpleRegex is an object oriented regular expressions library for PHP.
47

5-
This library allows to execute preg_* functions in PHP and use the results as objects, making the use of preg_* functions testeable. PhpSimpleRegex is integrated with PhpVerbalExpressions and Flux, to allow a full Object Oriented Regular Expressions use.
8+
This library allows to execute preg_* functions in PHP and use the results as objects, making the use of preg_* functions testeable. PhpSimpleRegex is integrated with [PhpVerbalExpressions](https://github.com/VerbalExpressions/PHPVerbalExpressions) and [Flux](https://github.com/selvinortiz/flux), to allow a full Object Oriented approach to Regular Expressions in PHP.
9+
10+
#### Why Simple?
11+
12+
My native language is spanish and the spanish definition of simple is __"Que es puramente aquello que se dice, sin ninguna característica especial o singular"__, which somehow translates to __"Something that is nothing more than what is told, without any special or singular characteristic"__. That's what I looked for in the design of this library, to be good in what it's intended for and nothing else.
13+
14+
Installation
15+
------------
16+
17+
#### Composer:
18+
19+
If you want to access directly to this repo, adding this to your composer.json should be enough:
20+
21+
```javascript
22+
{
23+
"repositories": [
24+
{
25+
"type": "vcs",
26+
"url": "https://github.com/mcustiel/php-simple-regex"
27+
}
28+
],
29+
"require": {
30+
"mcustiel/php-simple-regex": "dev-master"
31+
}
32+
}
33+
```
34+
35+
Or just download the release and include it in your path.
36+
37+
How to use it?
38+
--------------
39+
40+
This library provides a _facade_ class that wraps most of the preg_* functions from PHP. All you need to do is to create an instance of this class and call the methods you need.
41+
42+
```php
43+
use Mcustiel\PhpSimpleRegex\Executor as RegexExecutor;
44+
45+
$regexFacade = new RegexExecutor();
46+
```
47+
48+
#### List of methods:
49+
50+
* MatchResult getAllMatches(string $pattern, string $subject, integer $offset = 0)
51+
* Match getOneMatch(string $pattern, string $subject, integer $offset = 0)
52+
* boolean match(string $pattern, string $subject, integer $offset = 0)
53+
* ReplaceResult replaceAndCount(string $pattern, string $replacement, mixed $subject, integer $limit = -1)
54+
* mixed replace(string $pattern, string $replacement, mixed $subject, integer $limit = -1)
55+
* mixed replaceCallback(string $pattern, callable $callback, mixed $subject, integer $limit = -1)
56+
* ReplaceResult replaceCallbackAndCount(string $pattern, callable $callback, mixed $subject, integer $limit = -1)
57+

0 commit comments

Comments
 (0)