Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report

illuminate/database v11.2.0

The Illuminate Database package.
Package summary
Share
0
issues
0
licenses
Package created
5 Jun 2012
Version published
1 Apr 2024
Maintainers
1
Total deps
0
Direct deps
0
License
MIT
Generating a report...
Hold on while we generate a fresh audit report for this package.

Frequently Asked Questions

What does illuminate/database do?

The Illuminate/Database is a comprehensive database toolkit for PHP. It provides an expressive query builder, an ActiveRecord-style ORM, and a schema builder. The illuminate/database package supports various databases, including MySQL, Postgres, SQL Server, and SQLite. The application notably serves as the database layer for the Laravel PHP framework.

How do you use illuminate/database?

You can incorporate Illuminate/Database in your PHP project by creating a new "Capsule" manager instance. This makes the package easy to configure for usage outside the Laravel framework.

To do this, you need to use the code:

use Illuminate\Database\Capsule\Manager as Capsule;

$capsule = new Capsule;

$capsule->addConnection([
    'driver' => 'mysql',
    'host' => 'localhost',
    'database' => 'database',
    'username' => 'root',
    'password' => 'password',
    'charset' => 'utf8',
    'collation' => 'utf8_unicode_ci',
    'prefix' => '',
]);

Once the Capsule instance has been registered, you can use commands such as:

$users = Capsule::table('users')->where('votes', '>', 100)->get();
$results = Capsule::select('select * from users where id = ?', [1]);
Capsule::schema()->create('users', function ($table) {
    $table->increments('id');
    $table->string('email')->unique();
    $table->timestamps();
});

To use the Eloquent ORM, you can interact with your data models as in:

class User extends Illuminate\Database\Eloquent\Model {}

$users = User::where('votes', '>', 1)->get();

Where are the illuminate/database docs?

For extended documentation on how to use the various database facilities provided by this library, consult the Laravel framework documentation available on the Laravel website at https://laravel.com/docs.