2017 © Pedro Peláez
 

library db-app-package

A database application package for BEAR.Sunday

image

koriym/db-app-package

A database application package for BEAR.Sunday

  • Wednesday, May 23, 2018
  • by koriym
  • Repository
  • 1 Watchers
  • 4 Stars
  • 2,262 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 6 Versions
  • 3 % Grown

The README.md

Koriym.DbAppPackage

This package contains the following libraries., (*1)

Installation

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

Replace PackageModule with DbAppPackage in your AppModule., (*2)

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

Database

.env, (*3)

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

Create databse

php bin/create_db.php 

Database migrations

Create migration., (*4)

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

Perform migration., (*5)

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

see more at Phinx., (*6)

Route

Edit var/conf/aura.route.php., (*7)

<?php
/** @var $router \BEAR\Package\Provide\Router\AuraRoute */
$router->route('/task', '/task/{id}');

The Versions