Skip to content

Commit 12d2184

Browse files
committed
improve readme
1 parent d0749d6 commit 12d2184

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.md

+24
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,26 @@
11
# php-stream-parse-sql
22
PHP library to parse large SQL files command-by-command
3+
4+
It's not a real SQL parser though, it only cares about command integrity, but not syntax.
5+
6+
### Install:
7+
8+
```
9+
composer require lajosbencz/stream-parse-sql
10+
```
11+
12+
### Usage:
13+
14+
```php
15+
$parser = new LajosBencz\StreamParseSql\StreamParseSql("./my/large/file.sql");
16+
$parser->onProgress(function($position, $size) {
17+
echo ($position / $size) * 100, PHP_EOL;
18+
});
19+
foreacH($parser->parse() as $sqlCommand) {
20+
/** @var stdClass $myDb some database adapter */
21+
$myDb->execute($sqlCommand);
22+
}
23+
```
24+
25+
### Todo:
26+
* Extensively test if any input can produce a malformed command

0 commit comments

Comments
 (0)