• Stars
    star
    2,666
  • Rank 17,147 (Top 0.4 %)
  • Language
    PHP
  • License
    MIT License
  • Created over 12 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

[READ ONLY] Subtree split of the Illuminate Database component (see laravel/framework)

Illuminate Database

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

Usage Instructions

First, create a new "Capsule" manager instance. Capsule aims to make configuring the library for usage outside of the Laravel framework as easy as possible.

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' => '',
]);

// Set the event dispatcher used by Eloquent models... (optional)
use Illuminate\Events\Dispatcher;
use Illuminate\Container\Container;
$capsule->setEventDispatcher(new Dispatcher(new Container));

// Make this Capsule instance available globally via static methods... (optional)
$capsule->setAsGlobal();

// Setup the Eloquent ORM... (optional; unless you've used setEventDispatcher())
$capsule->bootEloquent();

composer require "illuminate/events" required when you need to use observers with Eloquent.

Once the Capsule instance has been registered. You may use it like so:

Using The Query Builder

$users = Capsule::table('users')->where('votes', '>', 100)->get();

Other core methods may be accessed directly from the Capsule in the same manner as from the DB facade:

$results = Capsule::select('select * from users where id = ?', [1]);

Using The Schema Builder

Capsule::schema()->create('users', function ($table) {
    $table->increments('id');
    $table->string('email')->unique();
    $table->timestamps();
});

Using The Eloquent ORM

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

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

For further documentation on using the various database facilities this library provides, consult the Laravel framework documentation.

More Repositories

1

contracts

[READ ONLY] Subtree split of the Illuminate Contracts component (see laravel/framework)
PHP
673
star
2

support

[READ ONLY] Subtree split of the Illuminate Support component (see laravel/framework)
PHP
561
star
3

html

[READ ONLY] Subtree split of the Illuminate HTML component (see laravel/framework)
PHP
364
star
4

container

[READ ONLY] Subtree split of the Illuminate Container component (see laravel/framework)
PHP
306
star
5

collections

[READ ONLY] Subtree split of the Illuminate Collections component (see laravel/framework)
PHP
226
star
6

queue

[READ ONLY] Subtree split of the Illuminate Queue component (see laravel/framework)
PHP
198
star
7

validation

[READ ONLY] Subtree split of the Illuminate Validation component (see laravel/framework)
PHP
173
star
8

filesystem

[READ ONLY] Subtree split of the Illuminate Filesystem component (see laravel/framework)
PHP
149
star
9

events

[READ ONLY] Subtree split of the Illuminate Events component (see laravel/framework)
PHP
130
star
10

cache

[READ ONLY] Subtree split of the Illuminate Cache component (see laravel/framework)
PHP
127
star
11

view

[READ ONLY] Subtree split of the Illuminate View component (see laravel/framework)
PHP
125
star
12

console

[READ ONLY] Subtree split of the Illuminate Console component (see laravel/framework)
PHP
120
star
13

routing

[READ ONLY] Subtree split of the Illuminate Routing component (see laravel/framework)
PHP
117
star
14

http

[READ ONLY] Subtree split of the Illuminate Http component (see laravel/framework)
PHP
115
star
15

config

[READ ONLY] Subtree split of the Illuminate Config component (see laravel/framework)
PHP
107
star
16

pagination

[READ ONLY] Subtree split of the Illuminate Pagination component (see laravel/framework)
PHP
101
star
17

session

[READ ONLY] Subtree split of the Illuminate Session component (see laravel/framework)
PHP
99
star
18

auth

[READ ONLY] Subtree split of the Illuminate Auth component (see laravel/framework)
PHP
90
star
19

pipeline

[READ ONLY] Subtree split of the Illuminate Pipeline component (see laravel/framework)
PHP
89
star
20

encryption

[READ ONLY] Subtree split of the Illuminate Encryption component (see laravel/framework)
PHP
87
star
21

redis

[READ ONLY] Subtree split of the Illuminate Redis component (see laravel/framework)
PHP
84
star
22

conditionable

PHP
76
star
23

broadcasting

[READ ONLY] Subtree split of the Illuminate Broadcasting component (see laravel/framework)
PHP
68
star
24

macroable

[READ ONLY] Subtree split of the Illuminate Macroable component (see laravel/framework)
PHP
68
star
25

translation

[READ ONLY] Subtree split of the Illuminate Translation component (see laravel/framework)
PHP
68
star
26

hashing

[READ ONLY] Subtree split of the Illuminate Hashing component (see laravel/framework)
PHP
63
star
27

log

[READ ONLY] Subtree split of the Illuminate Log component (see laravel/framework)
PHP
62
star
28

mail

[READ ONLY] Subtree split of the Illuminate Mail component (see laravel/framework)
PHP
60
star
29

bus

[READ ONLY] Subtree split of the Illuminate Bus component (see laravel/framework)
PHP
58
star
30

notifications

[READ ONLY] Subtree split of the Illuminate Notifications component (see laravel/framework)
PHP
49
star
31

process

PHP
45
star
32

socialite

A simple library for OAuth 2 authentication.
PHP
43
star
33

testing

[READ ONLY] Subtree split of the Illuminate Testing component (see laravel/framework)
PHP
33
star
34

workbench

[READ ONLY] Subtree split of the Illuminate Workbench component (see laravel/framework)
PHP
31
star
35

cookie

[READ ONLY] Subtree split of the Illuminate Cookie component (see laravel/framework)
PHP
22
star
36

exception

[READ ONLY] Subtree split of the Illuminate Exception component (see laravel/framework)
PHP
21
star
37

remote

[READ ONLY] Subtree split of the Illuminate Remote component (see laravel/framework)
PHP
17
star