PHPackages                             dcblogdev/sql-import - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. dcblogdev/sql-import

ActiveLibrary[Database &amp; ORM](/categories/database)

dcblogdev/sql-import
====================

Import .sql file into a database using PDO

v2.0.1(3y ago)98564MITPHPPHP &gt;=7.0.0

Since Jul 28Pushed 3y ago4 watchersCompare

[ Source](https://github.com/dcblogdev/sql-import)[ Packagist](https://packagist.org/packages/dcblogdev/sql-import)[ GitHub Sponsors](https://github.com/dcblogdev)[ RSS](/packages/dcblogdev-sql-import/feed)WikiDiscussions master Synced today

READMEChangelog (9)DependenciesVersions (10)Used By (0)

php Import SQL
==============

[](#php-import-sql)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c8f5d88c36a47397f8b6f295728745f1195a6082697dc55c3379e09b6bbf0bd3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6463626c6f676465762f73716c2d696d706f72742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dcblogdev/sql-import)[![Total Downloads](https://camo.githubusercontent.com/798d496b2a7689e81e7fe21991d73a9ccc333349281a36e2bda55477f4ffa2d0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6463626c6f676465762f73716c2d696d706f72742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dcblogdev/sql-import)

[![Logo](https://repository-images.githubusercontent.com/142712626/d110ff80-49c1-11eb-8153-e43e3960caca)](https://repository-images.githubusercontent.com/142712626/d110ff80-49c1-11eb-8153-e43e3960caca)

PDO import sql from a .sql file

Install
-------

[](#install)

Using composer include the repository by typing the following into a terminal

```
composer require dcblogdev/sql-import

```

Usage
-----

[](#usage)

Include the composer autoloader, import the Import namespace.

Define your database file path and credentials, the option dropTables, when set to true, will delete all the tables in the database before the sql file gets imported.

The option forceDropTables is optional and not recommended. When enabled together with dropTables, the deletion of tables will be executed with disabled foreign key checks. Only use this method if you are sure that the integrity of the existing data in the database does not matter.

```
use Dcblogdev\SqlImport\Import;

$filename = 'database.sql';
$username = 'root';
$password = '';
$database = 'sampleproject';
$host = 'dev';
$dropTables = true;
$forceDropTables = false;

new Import($filename, $username, $password, $database, $host, $dropTables, $forceDropTables);
```

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 69% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~201 days

Recently: every ~403 days

Total

9

Last Release

1329d ago

Major Versions

v0.0.4 → v1.0.02018-07-29

1.1.0 → 2.0.02020-12-27

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/39399156?v=4)[dcblog](/maintainers/dcblog)[@dcblog](https://github.com/dcblog)

---

Top Contributors

[![daveismynamecom](https://avatars.githubusercontent.com/u/60222583?v=4)](https://github.com/daveismynamecom "daveismynamecom (20 commits)")[![dcblogdev](https://avatars.githubusercontent.com/u/1018170?v=4)](https://github.com/dcblogdev "dcblogdev (6 commits)")[![mergeMarc](https://avatars.githubusercontent.com/u/19610853?v=4)](https://github.com/mergeMarc "mergeMarc (3 commits)")

---

Tags

hacktoberfestimporterphpsql

### Embed Badge

![Health badge](/badges/dcblogdev-sql-import/health.svg)

```
[![Health](https://phpackages.com/badges/dcblogdev-sql-import/health.svg)](https://phpackages.com/packages/dcblogdev-sql-import)
```

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.8k117.8M121](/packages/jdorn-sql-formatter)[backup-manager/backup-manager

A framework agnostic database backup manager with user-definable procedures and support for S3, Dropbox, FTP, SFTP, and more with drivers for popular frameworks.

1.7k1.6M11](/packages/backup-manager-backup-manager)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M88](/packages/propel-propel1)[insolita/yii2-migration-generator

Set of gii tools for generating files for migration by schema of table , phpdoc or table data

108508.0k5](/packages/insolita-yii2-migration-generator)[xpdo/xpdo

A PDO-based Object/Relational Bridge Library

7088.4k4](/packages/xpdo-xpdo)[voku/session2db

A PHP library acting as a wrapper for PHP's default session handling functions which stores data in a MySQL database, providing both better performance and better security and protection against session fixation and session hijacking.

2920.0k](/packages/voku-session2db)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
