Database
, (*1)
The DB package lets you manipulate the database, build SQL queries and manipulate the tables structure with Schema., (*2)
Installation
If you are working on an Asgard project you don't need to install this library as it is already part of the standard libraries., (*3)
composer require asgard/db 0.*
DB
To connect to the database and make SQL queries. See the documentation., (*4)
$rows = $db->query('SELECT * FROM news ORDER BY id DESC')->all();
DAL
To build SQL queries in a Object-Oriented manner. See the documentation., (*5)
$rows = $db-dal->from('news')->orderBy('id DESC')->all();
Schema
Build, modify and drop tables. See the documentation., (*6)
schema->table('news', function($table) {
$table->addColumn('id', 'integer', [
'length' => 11,
'autoincrement' => true,
]);
$table->addColumn('created_at', 'datetime', [
]);
$table->addColumn('updated_at', 'datetime', [
]);
$table->addColumn('title', 'string', [
'length' => '255',
]);
$table->setPrimaryKey(['id']);
});
Commands
List of commands that come with the DB package., (*7)
Contributing
Please submit all issues and pull requests to the asgardphp/asgard repository., (*8)
License
The Asgard framework is open-sourced software licensed under the MIT license, (*9)