A Spot (DataMapper ORM) service provider for Silex

1.0.0 2013-09-08 17:19 UTC


A Spot ServiceProvider for Silex

Spot is a lightweight DataMapper written for PHP5.3+, its really easy to use and perfect for a small application built in Silex


Passing a dsn string

In order to connect to your MySQL database, pass a valid DSN string into the provider

    new Psamatt\Silex\SpotServiceProvider('mysql://username:password@localhost/db_name')

In your index.php, you can then interact with Spot with the following lines:

// Find all the posts from the database where the status is 1
$app['spot']->all('Entity\Post', array('status' => 1));
// Find one post where the title is Test Post
$app['spot']->first('Entity\Post', array('title' => "Test Post"));

For more information on how to use Spot, see the github repository page


Vance Lucas