PHPackages                             bitolaco/silex-eloquent - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. bitolaco/silex-eloquent

ActiveLibrary[Database &amp; ORM](/categories/database)

bitolaco/silex-eloquent
=======================

Laravel Eloquent service provider for Silex applications

v0.1.1(11y ago)74.0k22MPLPHPPHP &gt;=5.4.0

Since Nov 21Pushed 11y ago1 watchersCompare

[ Source](https://github.com/BitolaCo/silex-eloquent)[ Packagist](https://packagist.org/packages/bitolaco/silex-eloquent)[ RSS](/packages/bitolaco-silex-eloquent/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (3)Versions (4)Used By (2)

[![Latest Stable Version](https://camo.githubusercontent.com/cbd05322ba8a0d80350480bb278a1a39d4aa3065b16f8161e112b5b73bbb4f42/68747470733a2f2f706f7365722e707567782e6f72672f6269746f6c61636f2f73696c65782d656c6f7175656e742f762f737461626c65)](https://packagist.org/packages/bitolaco/silex-eloquent)[![Total Downloads](https://camo.githubusercontent.com/f66bc3a0955565864969d6fa732668ffa162222108b23741804498b3c37a8fde/68747470733a2f2f706f7365722e707567782e6f72672f6269746f6c61636f2f73696c65782d656c6f7175656e742f646f776e6c6f616473)](https://packagist.org/packages/bitolaco/silex-eloquent)[![Latest Unstable Version](https://camo.githubusercontent.com/70cde73baab9b841700c6cfe03f9bcc5d0401d12315cb2cffc4b7197f9b91e92/68747470733a2f2f706f7365722e707567782e6f72672f6269746f6c61636f2f73696c65782d656c6f7175656e742f762f756e737461626c65)](https://packagist.org/packages/bitolaco/silex-eloquent)[![License](https://camo.githubusercontent.com/3aa8be2a236b33c08390328a817fc2f7c1676af53c67fe9509989e028cd78be0/68747470733a2f2f706f7365722e707567782e6f72672f6269746f6c61636f2f73696c65782d656c6f7175656e742f6c6963656e7365)](https://packagist.org/packages/bitolaco/silex-eloquent)

This package provides a Laravel Eloquent service provider for Silex applications. It was pulled from [this gist](https://gist.github.com/ziadoz/7326872) created by [Jamie York](https://github.com/ziadoz). It is his creation, not ours. We just maintain this version for use in our public and client projects.

The instructions below show basic usage, and assume that you're already familiar with [Eloquent and creating models, etc](http://laravel.com/docs/4.2/eloquent).

Silex 2 and the future
----------------------

[](#silex-2-and-the-future)

There's the basic code for updating this to Silex 2.x and Illuminate 5.1, but since Lumen has arrived on the scene, it seems that it would be a bit [redundant](https://github.com/BitolaCo/silex-eloquent/issues/1) to work on maintaining the project in the future for Silex 2. If you need Eloquent and a microframework for new proejcts, Lumen would seem to be the way to go.

That being said, if someone is interested in helping test the code already there in the [silex-v2 branch](https://github.com/BitolaCo/silex-eloquent/tree/silex-v2), let us know!

Unless that happens, we plan to maintain this until the end of life for Silex 1.X only.

Installation
------------

[](#installation)

This package is available to install via [Composer](https://getcomposer.org/). Just add it to your `composer.json` file as a requirement:

```
{
	"require": {
		"bitolaco/silex-eloquent": "*"
	}
}
```

Examples
--------

[](#examples)

### Single Connection

[](#single-connection)

```
$app = new Silex\Application;
$app->register(
	new \BitolaCo\Silex\CapsuleServiceProvider(),
	array(
		 'capsule.connection' => array(
			'driver' => 'mysql',
			'host' => 'localhost',
			'database' => 'dbname',
			'username' => 'root',
			'password' => '',
			'charset' => 'utf8',
			'collation' => 'utf8_unicode_ci',
			'prefix' => '',
			'logging' => true, // Toggle query logging on this connection.
		)
	)
);
```

### Multiple Connections

[](#multiple-connections)

```
