Development, Tools

I've released a new package to easily import a .sql file into a database using PDO.

To install the package import it using composer:

composer require daveismyname/sql-import

Or download and include import.php manually from

Then to use the library, define your database file path and credentials, the last option dropTables when set to true will delete all the tables in the database before import the sql file.


use Daveismyname\SqlImport\Import;

$filename = 'database.sql';
$username = 'root';
$password = '';
$database = 'sampleproject';
$host = 'localhost';
$dropTables = true;
new Import($filename, $username, $password, $database, $host, $dropTables);