Skip to content

Commit 5858156

Browse files
committed
Add code snippet in "README.md"
1 parent 7b5004a commit 5858156

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,29 @@
88

99
A package that creates PHP classes using PHP. That's it.
1010

11+
``` php
12+
use Rougin\Classidy\Classidy;
13+
use Rougin\Classidy\Generator;
14+
use Rougin\Classidy\Method;
15+
16+
$class = new Classidy;
17+
18+
$class->setName('Hello');
19+
20+
$method = new Method('hi');
21+
22+
$method->setCodeEval(function ()
23+
{
24+
return 'Hello world!';
25+
});
26+
27+
$class->addMethod($method);
28+
29+
$maker = new Generator;
30+
31+
echo $maker->make($class);
32+
```
33+
1134
## Installation
1235

1336
Install `Classidy` through [Composer](https://getcomposer.org/):

0 commit comments

Comments
 (0)