composer require mrceperka/sql-file-loader
- Statements in SQL file have to end with
;
- Loader does NOT check the SQL syntax
<?php
use \MrCeperka\SqlFileLoader\SqlFileLoader;
$resource = __DIR__ . '/data.sql';
// or with stdin
// $resource = fopen('php://stdin', 'r');
$loader = new SqlFileLoader($resource);
$queries = $loader->getQueries();