PHPackages                             nezarfadle/dbfixture - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. nezarfadle/dbfixture

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

nezarfadle/dbfixture
====================

Light fixtures loader

1.0.1(9y ago)032MITPHP

Since Jun 10Pushed 8y ago1 watchersCompare

[ Source](https://github.com/nezarfadle/DbFixture)[ Packagist](https://packagist.org/packages/nezarfadle/dbfixture)[ Docs](https://github.com/nezarfadle/dbfixture)[ RSS](/packages/nezarfadle-dbfixture/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

DbFixture
=========

[](#dbfixture)

This is a light class library working as SQL scripts Executer.

Installation
============

[](#installation)

`composer require nezarfadle/dbfixture`

Usage
=====

[](#usage)

1. Create a Database and name it `dbfixture` ( This could be any name ).
2. Create a folder and name it `fixtures` and save your fixtures files inside it:

```
fixtures/articles.create.sql
############################

CREATE TABLE IF NOT EXISTS `articles` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
```

```
fixtures/articles.drop.sql
##########################

DROP TABLE IF EXISTS articles;
```

```
fixtures/articles.insert.sql
############################

INSERT INTO articles values (1, 'PHP')
```

3. Create your own Fixture Class by extending the `DbFixture` class:

```
// MysqlDbFixture.php
