Giter Site home page Giter Site logo

capsule's Introduction

Laravel 4 Package Wrapper

A simple wrapper package for the Laravel packages. This is only to be used outside of a Laravel application.

Packages Covered

Only database for now, more to come.

Database Usage

Connecting

Before you can make any Capusle\DB calls or use any Eloquent Models, you must first make a connection using the Capsule\Database\Connection::make method.

Capsule\Database\Connection::make('main', [
    'driver'    => 'mysql',
    'host'      => 'localhost',
    'database'  => '',
    'username'  => '',
    'password'  => '',
    'collation' => 'utf8_general_ci',
    'prefix'    => '',
], true);

The make method has the following prototype:

public static function make($name, array $config, $default = false)

Using the Query Builder

You can use the Query Builder just as you would using the Db Facade in Laravel 4:

Capsule\DB::table('foo')->select('*')->get()

Note: You can use DbWrapper in your PHP files so you can simply use Db without the namespace.

Eloquent Models

You can extend the Illuminate\Database\Eloquent\Model class and use the Models as you normally would. When Capsule\Database\Connection::make is called it also sets up Eloquent for you.

Schema Builder

Capsule provides a nice Capsule\Schema class, which acts exactly like the Schema Facade in Laraval.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.