PHPackages                             korstiaan/drimple - 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. [Framework](/categories/framework)
4. /
5. korstiaan/drimple

ActiveDrupal-module[Framework](/categories/framework)

korstiaan/drimple
=================

Module which adds a Dependency Injection Container using Pimple to Drupal 7.x.

932PHP

Since Jul 24Pushed 12y agoCompare

[ Source](https://github.com/korstiaan/drimple)[ Packagist](https://packagist.org/packages/korstiaan/drimple)[ RSS](/packages/korstiaan-drimple/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

Drimple for Drupal 7.x
======================

[](#drimple-for-drupal-7x)

Module which adds a Dependency Injection Container using [Pimple](https://github.com/fabpot/Pimple) to Drupal.

[![Build Status](https://camo.githubusercontent.com/70571f5afbc1a7e87110c3395ae6cfa49c65925e18c6fce45c051c971c00bc74/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f6b6f7273746961616e2f6472696d706c652e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/korstiaan/drimple)

Requirements
------------

[](#requirements)

- Drupal 7.x
- PHP 5.3.3+
- [Pimple](https://github.com/fabpot/Pimple)

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

[](#installation)

The recommended way to install `Drimple` is with [Composer](http://getcomposer.org). Just add the following to your `composer.json`:

```
   {
   	   "minimum-stability": "dev",
	   "require": {
	   	   ...
		   "korstiaan/drimple": "dev-master"
	   }
   }
```

Now update composer and install the newly added requirement and its dependencies (including `Pimple`):

```
$ php composer.phar update korstiaan/drimple
```

If all went well and `composer/installers` did its job, `Drimple` was installed to `modules/drimple`. If you don't want it there, or it's not part of your Drupal rootdir, symlink it to your folder of choice.

Next go to `site/all/modules` and enable it on `http://yourdomain.com/admin/modules/list`.

(If you're using [voiture](http://voiture.hoppinger.com) just add `drimple` to `cnf/shared/modules.php`)

### Using Composer

[](#using-composer)

Using `Composer` means including its autoloader. Add the following to your Drupals settings.php:

```
// /path/to/sites/default/settings.php

require '/path/to/vendor/autoload.php';
```

Usage
-----

[](#usage)

`Drimple`s container and its services can then be retrieved as singleton via `drimple()` or `\Drimple\Drimple::getInstance()`.

### Adding services

[](#adding-services)

Recommended way of adding services is by implementing `hook_drimple_provide(\Drimple\Drimple $drimple)`:

```
