Maintainers

Details

github.com/asgardphp/db

Source

v0.3.1 2016-05-13 11:31 UTC

This package is not auto-updated.

Last update: 2024-11-01 07:34:26 UTC


README

#Database

Build Status

The DB package lets you manipulate the database, build SQL queries and manipulate the tables structure with Schema.

##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.

composer require asgard/db 0.*

##DB

To connect to the database and make SQL queries. See the documentation.

$rows = $db->query('SELECT * FROM news ORDER BY id DESC')->all();

##DAL

To build SQL queries in a Object-Oriented manner. See the documentation.

$rows = $db-dal->from('news')->orderBy('id DESC')->all();

##Schema

Build, modify and drop tables. See the documentation.

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.

###Contributing

Please submit all issues and pull requests to the asgardphp/asgard repository.

License

The Asgard framework is open-sourced software licensed under the MIT license