Skip to content

Commit

Permalink
updated README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
d4s6 committed Jan 18, 2023
1 parent 18fe663 commit c851abd
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@
Line numbers as _immutable_ value objects.
With a [WeakMap](https://www.php.net/WeakMap) based repository in the background.

## installation

```bash
composer require davidschwarz/line-number
```

## example

```php
require __DIR__ . '/vendor/autoload.php';

use DavidSchwarz\LineNumber\Line;

$startLine = Line::number(0);
Expand All @@ -17,9 +25,9 @@ $otherLine->equals(2); // TRUE
(string) Line::number(7); // '7'
Line::number(7)->i; // 7

Line::number(-1); // ...\NegativeValueError
Line::number(-1); // throws ...\NegativeValueError

Line::number(0)->subtract(2); // ...\NegativeResultError
Line::number(0)->subtract(2); // throws ...\NegativeResultError

```

Expand Down

0 comments on commit c851abd

Please sign in to comment.