Skip to content

Commit 1bc9f74

Browse files
committed
update README.md
1 parent 1e5a3a8 commit 1bc9f74

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ComposerParser
22

3-
A parser that can parse the composer.json file of installed PHP packages.
3+
A parser that can parse the composer.json file of all installed PHP packages.
44

55
<p align="left">
66
<a href="https://github.com/xdevor/composer-parser/actions"><img src="https://github.com/xdevor/composer-parser/actions/workflows/tests.yml/badge.svg" alt="Test Status"></a>
@@ -17,14 +17,16 @@ composer require xdevor/composer-parser
1717

1818
## Usage
1919

20-
1. parse composer.json file of installed PHP packages
20+
1. parse composer.json file of all installed PHP packages
2121
```php
2222
...
2323
use Xdevor\ComposerParser\Parser;
2424
...
2525
(new Parser())->parse('the/package', 'name'); // return name of the package
26-
(new Parser())->parse('the/package', 'not_exist_key'); // return null
2726
(new Parser())->parse('the/package', 'authors.0.name'); // return the first author name
27+
(new Parser())->parse('the/package', 'not_exist_key'); // return null if key not exist
28+
(new Parser())->parse('the/package', 'not_exist_key', 'default'); // return 'default' if key not exist
29+
(new Parser(__DIR__ . '/customize/path/installed.json'))->parse('the/package', 'name'); // parse customize path
2830
```
2931

3032
## Contributing

0 commit comments

Comments
 (0)