Skip to content

Commit fdff107

Browse files
committed
added Composer and PHPUnit integration
1 parent 1206366 commit fdff107

File tree

9 files changed

+544
-14
lines changed

9 files changed

+544
-14
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/vendor

Example.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* 22.July.2013
66
*/
77

8-
require_once 'VerbalExpressions.php';
8+
$loader = require __DIR__ . '/vendor/autoload.php';
99

1010
$regex = new \VerbalExpressions\PHPVerbalExpressions\VerbalExpressions();
1111

README.md

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,24 @@ VerbalExpressions is a PHP library that helps to construct hard regular expressi
1010

1111
$regex = new VerbalExpressions;
1212

13-
$regex ->startOfLine()
14-
->then("http")
15-
->maybe("s")
16-
->then("://")
17-
->maybe("www.")
18-
->anythingBut(" ")
19-
->endOfLine();
13+
$regex ->startOfLine()
14+
->then("http")
15+
->maybe("s")
16+
->then("://")
17+
->maybe("www.")
18+
->anythingBut(" ")
19+
->endOfLine();
2020

2121

2222
if($regex->test("http://github.com"))
23-
echo "valid url";
23+
echo "valid url";
2424
else
25-
echo "invalid url";
25+
echo "invalid url";
2626

2727
if (preg_match($regex, 'http://github.com')) {
28-
echo 'valid url';
28+
echo 'valid url';
2929
} else {
30-
echo 'invalud url';
30+
echo 'invalud url';
3131
}
3232

3333

@@ -36,8 +36,8 @@ echo "<pre>". $regex->getRegex() ."</pre>";
3636

3737

3838
echo $regex ->clean(array("modifiers" => "m", "replaceLimit" => 4))
39-
->find(' ')
40-
->replace("This is a small test http://somesite.com and some more text.", "-");
39+
->find(' ')
40+
->replace("This is a small test http://somesite.com and some more text.", "-");
4141

4242
```
4343

@@ -49,3 +49,13 @@ You can see an up to date list of all ports on [VerbalExpressions.github.io](htt
4949
- [Python](https://github.com/VerbalExpressions/PythonVerbalExpressions)
5050
- [Java](https://github.com/VerbalExpressions/JavaVerbalExpressions)
5151
- [C++](https://github.com/VerbalExpressions/CppVerbalExpressions)
52+
53+
## Building the project and running the tests
54+
The project supports Composer so you have to install [Composer](http://getcomposer.org/doc/00-intro.md#installation-nix) first before project setup.
55+
56+
curl -sS https://getcomposer.org/installer | php
57+
php composer.phar install --dev
58+
ln -s vendor/phpunit/phpunit/phpunit.php phpunit
59+
./phpunit
60+
61+

composer.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "VerbalExpressions/PHPVerbalExpressions",
3+
"license": "MIT",
4+
"type": "project",
5+
"description": "PHP Regular expressions made easy",
6+
"require": {
7+
},
8+
"require-dev": {
9+
"phpunit/phpunit": "~3.7"
10+
},
11+
"minimum-stability": "stable",
12+
"autoload": {
13+
"psr-0": {
14+
"VerbalExpressions": "src/"
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)