Maintainers

Details

github.com/asgardphp/db

Source

Installs: 1 078

Dependents: 5

Suggesters: 1

Stars: 0

Watchers: 1

Forks: 0

v0.3.1 2016-05-13 11:31 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