PHPackages                             koriym/db-app-package - 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. koriym/db-app-package

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

koriym/db-app-package
=====================

A database application package for BEAR.Sunday

1.1.0(8y ago)53.2k1MITPHPPHP &gt;=7.0.0

Since Mar 7Pushed 6y ago1 watchersCompare

[ Source](https://github.com/koriym/Koriym.DbAppPackage)[ Packagist](https://packagist.org/packages/koriym/db-app-package)[ RSS](/packages/koriym-db-app-package/feed)WikiDiscussions 1.x Synced today

READMEChangelog (5)Dependencies (9)Versions (6)Used By (0)

Koriym.DbAppPackage
===================

[](#koriymdbapppackage)

This package contains the following libraries.

- [Aura.Router v2](https://github.com/auraphp/Aura.Router/tree/2.x) A web router implementation for PHP.
- [Aura.Sql v2](https://github.com/auraphp/Aura.Sql) Adapters for SQL database access
- [Aura.SqlQuery v2](https://github.com/auraphp/Aura.SqlQuery) Independent query builders for MySQL, PostgreSQL, SQLite, and Microsoft SQL Server.
- [Phinx](https://phinx.org/) Database migrations
- [Koriym.QueryLocator](https://github.com/koriym/Koriym.QueryLocator) SQL locator
- [Koriym.DevPdoDtatement](https://github.com/koriym/Koriym.DevPdoStatement) PDOStatement for query inspection

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

[](#installation)

Composer Intall
---------------

[](#composer-intall)

```
composer create-project bear/skeleton {project-path}

```

```
Created project in my-project
> BEAR\Skeleton\Installer::preInstall

What is the vendor name ?

(MyVendor):

What is the project name ?

(MyProject):

```

```
cd {project-path}
composer require koriym/db-app-package
php vendor/koriym/db-app-package/bin/install.php

```

Module Install
--------------

[](#module-install)

Replace `PackageModule` with `DbAppPackage` in your AppModule.

```
use josegonzalez\Dotenv\Loader as Dotenv;
use Koriym\DbAppPackage\DbAppPackage; // add this line
use Ray\Di\AbstractModule;

class AppModule extends AbstractModule
{
    /**
     * {@inheritdoc}
     */
    protected function configure()
    {
        Dotenv::load([
            'filepath' => dirname(dirname(__DIR__)) . '/.env',
            'toEnv' => true
        ]);
         // add this line
        $this->install(new DbAppPackage($_ENV['DB_DSN'], $_ENV['DB_USER'], $_ENV['DB_PASS'], $_ENV['DB_READ']));
    }
}

```

Configuration
=============

[](#configuration)

Database
--------

[](#database)

`.env`

```
DB_DSN=mysql:host=localhost;dbname=task
DB_USER=root
DB_PASS=
DB_READ=

```

Create databse
--------------

[](#create-databse)

```
php bin/create_db.php

```

Database migrations
-------------------

[](#database-migrations)

Create migration.

```
php vendor/bin/phinx create -c var/db/phinx.php MyNewMigration

```

Perform migration.

```
php vendor/bin/phinx migrate -c var/db/phinx.php

```

see more at [Phinx](http://docs.phinx.org/).

Route
=====

[](#route)

Edit `var/conf/aura.route.php`.

```
