Skip to content

Commit 3ba763b

Browse files
committed
Update README file
1 parent 11c43b1 commit 3ba763b

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

README.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,48 @@ Implementing the Specification pattern in PHP
88
[![Total Downloads](https://img.shields.io/packagist/dt/bakame/spec.svg?style=flat-square)](https://packagist.org/packages/bakame/spec)
99
[![Sponsor development of this project](https://img.shields.io/badge/sponsor%20this%20package-%E2%9D%A4-ff69b4.svg?style=flat-square)](https://github.com/sponsors/nyamsprod)
1010

11-
### System Requirements
11+
System Requirements
12+
------------
1213

1314
You need:
1415

1516
- **PHP >= 8.0** but the latest stable version of PHP is recommended
1617

17-
### Installation
18+
Installation
19+
------------
20+
21+
Use composer:
1822

1923
```
2024
composer require bakame/spec
2125
```
2226

23-
### What is it ?
27+
or download the library and:
28+
29+
- use any other [PSR-4][4] compatible autoloader.
30+
- use the bundle autoloader script as shown below:
31+
32+
~~~php
33+
require 'path/to/spec/repo/autoload.php';
34+
35+
use Bakame\Http\Specification\Chain;
36+
37+
$spec = Chain::one(new Rule())->andX(new Rule2());
38+
$spec->isSatisfiedBy($subject);
39+
~~~
40+
41+
What is it ?
42+
------------
2443

2544
> "the specification pattern is a particular software design pattern,
2645
whereby business rules can be recombined by chaining the business
2746
rules together using boolean logic. The pattern is frequently used in
2847
the context of domain-driven design." -- [wikipedia](https://en.wikipedia.org/wiki/Specification_pattern)
2948

30-
### How do I use it?
49+
How do I use it?
50+
------------
3151

32-
Each rule that needs to be used MUST implement the `Bakame\Specification\Specification` interface.
52+
Each rule that needs to be validated MUST implement the `Bakame\Specification\Specification` interface.
3353

3454
Here's a quick example. First, create a specification implementing class.
3555

0 commit comments

Comments
 (0)