This package contains the following libraries.
- Aura.Router v2 A web router implementation for PHP.
- Aura.Sql v2 Adapters for SQL database access
- Aura.SqlQuery v2 Independent query builders for MySQL, PostgreSQL, SQLite, and Microsoft SQL Server.
- Phinx Database migrations
- Koriym.QueryLocator SQL locator
- Koriym.DevPdoDtatement PDOStatement for query inspection
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
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']));
}
}
.env
DB_DSN=mysql:host=localhost;dbname=task
DB_USER=root
DB_PASS=
DB_READ=
php bin/create_db.php
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.
Edit var/conf/aura.route.php
.
<?php
/** @var $router \BEAR\Package\Provide\Router\AuraRoute */
$router->route('/task', '/task/{id}');