PHPackages                             ronanchilvers/silex-spot2-provider - 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. ronanchilvers/silex-spot2-provider

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

ronanchilvers/silex-spot2-provider
==================================

Provider for the Spot2 orm (vlucas/spot2)

1.0(10y ago)0230MITPHP

Since Jan 12Pushed 9y ago1 watchersCompare

[ Source](https://github.com/ronanchilvers/silex-spot2-provider)[ Packagist](https://packagist.org/packages/ronanchilvers/silex-spot2-provider)[ RSS](/packages/ronanchilvers-silex-spot2-provider/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (4)Dependencies (3)Versions (6)Used By (0)

Silex Provider for the Spot2 ORM
================================

[](#silex-provider-for-the-spot2-orm)

[![SensioLabsInsight](https://camo.githubusercontent.com/45b8715f9239365e4c0e9f18ff214ee5d82c16c7cedb917520aa1a332e67f688/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f63303537383561612d336633312d343161332d386430382d3339393639316530643430372f6d696e692e706e67)](https://insight.sensiolabs.com/projects/c05785aa-3f31-41a3-8d08-399691e0d407)

Spot2 is a simple ORM for [Silex](http://silex.sensiolabs.org/) projects based on the data mapper pattern. You can read more about it [on the github page](https://github.com/vlucas/spot2) or the [documentation site](http://phpdatamapper.com/).

This project comprises a service provider and utility for hooking Spot2 up to your Silex app.

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

[](#installation)

The easiest mechanism is via composer. :

```
composer require ronanchilvers/silex-spot2-provider ^1.0
```

Silex2 is supported in the master branch although there isn't yet a release. If you want to use the Silex2 version you can do:

```
composer require ronanchilvers/silex-spot2-provider dev-master
```

Usage
-----

[](#usage)

To register the service provider you can do something like this:

```
$app->register(new \Ronanchilvers\Silex\Provider\Spot2ServiceProvider(), [
    'spot2.connections' => [
        'default' => 'sqlite://path/to/my_database.sqlite'
    ]
]);

$app->get('/things', function() use ($app) {
    $mapper = $app['spot2.locator']->mapper('Entity\Thing');

    $this->render('things.twig', [
        'things' => $mapper->all()
    ]);
});
```

Utility trait
-------------

[](#utility-trait)

If you want to use the utility trait, just include it in your subclassed application.

```
class Application extends Silex\Application
{
    use \Ronanchilvers\Silex\Application\Spot2Trait;
}
```

You then get the following convenience methods.

### mapper()

[](#mapper)

This method is a shortcut for getting a mapper out for a particular entity.

```
$app->get('/things', function() use ($app) {
    $mapper = $this->mapper('Entity\Thing');

    return $this->render('things.twig', [
        'things' => $mapper->all()
    ]);
});
```

### spot2()

[](#spot2)

This method is a shortcut for getting the spot2 locator object. Most of the time you won't use this method (you'll probably use mapper() instead). It exists just to allow easy access to the locator if required.

```
$app->get('/things', function() use ($app) {
    $mapper = $this->spot2()->mapper('Entity\Thing');

    return $this->render('things.twig', [
        'things' => $mapper->all()
    ]);
});
```

Services Exposed
----------------

[](#services-exposed)

The Spot2ServiceProvider exposes the following services.

- `spot2.connections` - an array of connection DSNs or DBAL style configuration arrays
- `spot2.connections.default` - the name of the default connection to use. Spot2 will take the first defined one as the default if you don't set one explicitly.
- `spot2.config`- the Spot2 config object
- `spot2.locator` - the Spot2 locator object

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

5

Last Release

3774d ago

Major Versions

0.3 → 1.02016-01-12

### Community

Maintainers

![](https://www.gravatar.com/avatar/f6d7178329cb95270cfb9c807c3d2a6485d0f856c3d81cfe432e469e5f958748?d=identicon)[ronanchilvers](/maintainers/ronanchilvers)

---

Top Contributors

[![ronanchilvers](https://avatars.githubusercontent.com/u/87890?v=4)](https://github.com/ronanchilvers "ronanchilvers (26 commits)")

---

Tags

ormservice providersilexspot2

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ronanchilvers-silex-spot2-provider/health.svg)

```
[![Health](https://phpackages.com/badges/ronanchilvers-silex-spot2-provider/health.svg)](https://phpackages.com/packages/ronanchilvers-silex-spot2-provider)
```

###  Alternatives

[dflydev/doctrine-orm-service-provider

Doctrine ORM Service Provider

2081.7M35](/packages/dflydev-doctrine-orm-service-provider)[csanquer/pdo-service-provider

a PDO database service provider for silex

19199.0k](/packages/csanquer-pdo-service-provider)[palma/doctrineormserviceprovider

A Silex DoctrineORM Service provider

112.7k](/packages/palma-doctrineormserviceprovider)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
