• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

Capsule/H03-May-2022-20282

Concerns/H03-May-2022-430206

Connectors/H03-May-2022-1,030486

Console/H03-May-2022-1,892924

DBAL/H03-May-2022-11159

Eloquent/H03-May-2022-15,9106,972

Events/H03-May-2022-385149

Migrations/H03-May-2022-1,356627

PDO/H03-May-2022-419207

Query/H03-May-2022-6,3512,624

Schema/H03-May-2022-7,0322,896

ClassMorphViolationException.phpH A D03-Dec-2021525 3013

ConfigurationUrlParser.phpH A D03-Dec-2021192 116

Connection.phpH A D03-Dec-202130.8 KiB1,265512

ConnectionInterface.phpH A D03-Dec-20213.6 KiB16324

ConnectionResolver.phpH A D03-Dec-20211.9 KiB9336

ConnectionResolverInterface.phpH A D03-Dec-2021575 308

DatabaseManager.phpH A D03-Dec-20219.5 KiB352142

DatabaseServiceProvider.phpH A D03-Dec-20212.8 KiB10054

DatabaseTransactionRecord.phpH A D03-Dec-20211.3 KiB7427

DatabaseTransactionsManager.phpH A D03-Dec-20212.2 KiB9744

DetectsConcurrencyErrors.phpH A D03-Dec-20211.1 KiB3826

DetectsDeadlocks.phpH A D03-Dec-2021891 3322

DetectsLostConnections.phpH A D03-Dec-20211.3 KiB4433

Grammar.phpH A D03-Dec-20215.2 KiB22495

LICENSE.mdH A D03-Dec-20211 KiB2217

LazyLoadingViolationException.phpH A D03-Dec-2021771 4015

MigrationServiceProvider.phpH A D03-Dec-20212 KiB8242

MultipleRecordsFoundException.phpH A D03-Dec-2021134 116

MySqlConnection.phpH A D03-Dec-20212.1 KiB8543

PostgresConnection.phpH A D03-Dec-20211.7 KiB6733

QueryException.phpH A D03-Dec-20211.6 KiB7932

README.mdH A D03-Dec-20212.2 KiB7050

RecordsNotFoundException.phpH A D03-Dec-2021129 116

SQLiteConnection.phpH A D03-Dec-20212.7 KiB10148

Seeder.phpH A D03-Dec-20212.7 KiB12859

SqlServerConnection.phpH A D03-Dec-20213.1 KiB11457

composer.jsonH A D03-Dec-20211.4 KiB4746

README.md

1## Illuminate Database
2
3The Illuminate Database component is a full database toolkit for PHP, providing an expressive query builder, ActiveRecord style ORM, and schema builder. It currently supports MySQL, Postgres, SQL Server, and SQLite. It also serves as the database layer of the Laravel PHP framework.
4
5### Usage Instructions
6
7First, create a new "Capsule" manager instance. Capsule aims to make configuring the library for usage outside of the Laravel framework as easy as possible.
8
9```PHP
10use Illuminate\Database\Capsule\Manager as Capsule;
11
12$capsule = new Capsule;
13
14$capsule->addConnection([
15    'driver'    => 'mysql',
16    'host'      => 'localhost',
17    'database'  => 'database',
18    'username'  => 'root',
19    'password'  => 'password',
20    'charset'   => 'utf8',
21    'collation' => 'utf8_unicode_ci',
22    'prefix'    => '',
23]);
24
25// Set the event dispatcher used by Eloquent models... (optional)
26use Illuminate\Events\Dispatcher;
27use Illuminate\Container\Container;
28$capsule->setEventDispatcher(new Dispatcher(new Container));
29
30// Make this Capsule instance available globally via static methods... (optional)
31$capsule->setAsGlobal();
32
33// Setup the Eloquent ORM... (optional; unless you've used setEventDispatcher())
34$capsule->bootEloquent();
35```
36
37> `composer require "illuminate/events"` required when you need to use observers with Eloquent.
38
39Once the Capsule instance has been registered. You may use it like so:
40
41**Using The Query Builder**
42
43```PHP
44$users = Capsule::table('users')->where('votes', '>', 100)->get();
45```
46Other core methods may be accessed directly from the Capsule in the same manner as from the DB facade:
47```PHP
48$results = Capsule::select('select * from users where id = ?', [1]);
49```
50
51**Using The Schema Builder**
52
53```PHP
54Capsule::schema()->create('users', function ($table) {
55    $table->increments('id');
56    $table->string('email')->unique();
57    $table->timestamps();
58});
59```
60
61**Using The Eloquent ORM**
62
63```PHP
64class User extends Illuminate\Database\Eloquent\Model {}
65
66$users = User::where('votes', '>', 1)->get();
67```
68
69For further documentation on using the various database facilities this library provides, consult the [Laravel framework documentation](https://laravel.com/docs).
70