PHPackages                             baneeishaque/mysql-db-exporter - 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. baneeishaque/mysql-db-exporter

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

baneeishaque/mysql-db-exporter
==============================

Export MySQL Database

002[2 issues](https://github.com/Baneeishaque/MySQL_DB_Backup/issues)PHP

Since Feb 28Pushed 5y agoCompare

[ Source](https://github.com/Baneeishaque/MySQL_DB_Backup)[ Packagist](https://packagist.org/packages/baneeishaque/mysql-db-exporter)[ RSS](/packages/baneeishaque-mysql-db-exporter/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Database Backup Library
=======================

[](#database-backup-library)

Initialize
----------

[](#initialize)

```
include('db_backup_library.php');
$dbbackup = new db_backup;
```

Just Use `include()` or `require() ` to the `'db_backup_library.php'` File And create an object of `'db_backup'` class

Methods
-------

[](#methods)

- [connect()](#connect)
- [backup()](#backup)
- [tables()](#tables)
- [download()](#download)
- [save()](#save)
- [db\_import()](#db_import)

### `connect()`

[](#connect)

**This is an Opotional Method**If your project connected with Server and database already then you don't need to use this Method, Other wise you can use this method to connect with MySQL Server and Database

**Example**

```
include('db_backup_library.php');
$dbbackup = new db_backup;
$dbbackup->connect("Server Name", Username, passwrd, Database)
```

### `backup()`

[](#backup)

**This is a Mendatory Method**After connecting with Server and Database you must call this method other wise other method cannot work.

**Example**

```
include('db_backup_library.php');
$dbbackup = new db_backup;
$dbbackup->connect("ServerName","Username","passwrd","Database");
$dbbackup->backup();
```

### `tables()`

[](#tables)

If you need to show the name of all tables in database just call this method it will return an array with the name of all tables in the database.

**Example**

```
include('db_backup_library.php');
$dbbackup = new db_backup;
$dbbackup->connect("ServerName","Username","passwrd","Database");
$dbbackup->backup();
print_r($dbbackup->tables());
```

### `download()`

[](#download)

If you want to download The database you can use this method. After run this method you will see a Download Popup menu of database SQL file.

**Example**

```
Download
```

**'download.php' Contain Only This code:**

```
include('db_backup_library.php');
$dbbackup = new db_backup;
$dbbackup->connect("ServerName","Username","passwrd","Database");
$dbbackup->backup();
$dbbackup->download();
```

#### Note: This is the better way to keep the download code into a single page.

[](#note-this-is-the-better-way-to-keep-the-download-code-into-a-single-page)

### `save()`

[](#save)

If you want to save the backup file into a server directory you can use this method

#### Parameters

[](#parameters)

It has 2 Parameters

> 1st parameter is Target path (where you want to save the file) *It is Mendatory* If you want to kip it blank you can just use `save("")`

> 2nd Parameter is (Optional) name of The file Default is *'backup\_yyy-mm-dd.sql'*

**Example**

```
include('db_backup_library.php');
$dbbackup = new db_backup;
$dbbackup->connect("ServerName","Username","passwrd","Database");
$dbbackup->backup();
$dbbackup->save("file/","backup"));
```

### db\_import()

[](#db_import)

To Import the SQL File into your Database you can use this method just call the method with the source path of sql file as parameter Then it will import your database

#### Parameters

[](#parameters-1)

It has 1 Parameters

> The parameter is source path of sql file.

**Example**

```
include('db_backup_library.php');
$dbbackup = new db_backup;
$dbbackup->connect("ServerName","Username","passwrd","Database");
$dbbackup->backup();
$dbbackup->db_import("test.sql"));
```

If you have any question about this, just knock me on facebook or email

Fb: [fb/emarufhasan](https://facebook.com/emarufhasan)Gmail:

See the Video Tutorial:

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

 Bus Factor1

Top contributor holds 63.2% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/f2fd4b1be7b4630781a352b5ee87df1c66e86f9141bf2f0225bef144399b6cef?d=identicon)[Baneeishaque](/maintainers/Baneeishaque)

---

Top Contributors

[![marufhasan1](https://avatars.githubusercontent.com/u/17230515?v=4)](https://github.com/marufhasan1 "marufhasan1 (60 commits)")[![baneeishaque](https://avatars.githubusercontent.com/u/6133009?v=4)](https://github.com/baneeishaque "baneeishaque (17 commits)")[![Baneeishaque](https://avatars.githubusercontent.com/u/6133009?v=4)](https://github.com/Baneeishaque "Baneeishaque (17 commits)")[![mend-bolt-for-github[bot]](https://avatars.githubusercontent.com/in/16809?v=4)](https://github.com/mend-bolt-for-github[bot] "mend-bolt-for-github[bot] (1 commits)")

---

Tags

dbmysqlmysql-backupmysql-databasemysql-servermysqldumpmysqliphpphp-libraryphp5

### Embed Badge

![Health badge](/badges/baneeishaque-mysql-db-exporter/health.svg)

```
[![Health](https://phpackages.com/badges/baneeishaque-mysql-db-exporter/health.svg)](https://phpackages.com/packages/baneeishaque-mysql-db-exporter)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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