PHPackages                             c33s/propel-di-behavior-bundle - 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. c33s/propel-di-behavior-bundle

AbandonedSymfony-bundle[Framework](/categories/framework)

c33s/propel-di-behavior-bundle
==============================

Clean Symfony2 dependency injection for your Propel models

v0.1.1(11y ago)2131MITPHPPHP &gt;=5.4.0

Since Apr 27Pushed 11y ago1 watchersCompare

[ Source](https://github.com/vworldat/C33sPropelDIBehaviorBundle)[ Packagist](https://packagist.org/packages/c33s/propel-di-behavior-bundle)[ Docs](https://github.com/vworldat/C33sPropelDIBehaviorBundle)[ RSS](/packages/c33s-propel-di-behavior-bundle/feed)WikiDiscussions master Synced 1mo ago

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

C33sPropelDIBehaviorBundle
==========================

[](#c33spropeldibehaviorbundle)

Clean Symfony2 dependency injection for your Propel models

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

[](#installation)

This bundle depends on [`GlorpenPropelBundle`](https://bitbucket.org/glorpen/glorpenpropelbundle). **Install that one first**.

Require [`c33s/propel-di-behavior-bundle`](https://packagist.org/packages/c33s/propel-di-behavior-bundle)in your `composer.json` file:

```
{
    "require": {
        "c33s/propel-di-behavior-bundle": "@stable",
    }
}
```

Add propel behaviors to your propel config:

```
# app/config/config.yml

propel:
    # ...

    behaviors:
        c33s_di:        vendor.c33s.propel-di-behavior-bundle.src.C33sPropelDependencyCollectorBehavior

        # Optional: add another "instance" for global usage that does not interfere with model-specific behavior instances
        c33s_di_global: vendor.c33s.propel-di-behavior-bundle.src.C33sPropelDependencyCollectorBehavior
```

Register the bundle in `app/AppKernel.php`:

```
    // app/AppKernel.php

    public function registerBundles()
    {
        return array(
            // ...

            new C33s\PropelDIBehaviorBundle\C33sPropelDIBehaviorBundle(),
        );
    }
```

Usage
-----

[](#usage)

Add behavior to your propel models - either globally (use the `c33s_di_global` name for that) or to a specific model. You may inject Symfony2 services or parameters into any `Model` or `Query` class. Each definition consists of the service or parameter name to inject (enclose parameters in %-chars) followed by optional getter methods and type hints for this methods, separated by colons:

- `logger:getLogger:\Psr\Log\LoggerInterface` injects the Symfony2 logger service, making it accessible by `$model->getLogger()`(or `$query->getLogger()`) and providing `\Psr\Log\LoggerInterface` as a type hint for that getter
- `logger` injects the Symfony2 logger service without an explicit getter. Use `$model->getInjectedDependency('logger')` to access it.
- `%locale%:getLocale:string` injects the `locale` parameter, providing a getLocale() method for accessing it.

### Example schema

[](#example-schema)

```

```

How it works
------------

[](#how-it-works)

`C33sPropelDIBehaviorBundle` registers event listeners for `model.create` and `query.create` that are processed by `GlorpenPropelBundle`. Upon each model or query creation anonymous callbacks for each service will be injected into the classes, making sure that only the services that were specified in the schema can be accessed. The callback furthermore ensures that no services will be instantiated without actually being used.

So far this is the cleanest way I have found to inject specific Symfony2 dependencies into Propel models without messing around with the full DI container.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 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 ~10 days

Total

2

Last Release

4028d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/649209?v=4)[Julian](/maintainers/c33s)[@c33s](https://github.com/c33s)

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

---

Top Contributors

[![vworldat](https://avatars.githubusercontent.com/u/650955?v=4)](https://github.com/vworldat "vworldat (5 commits)")

### Embed Badge

![Health badge](/badges/c33s-propel-di-behavior-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/c33s-propel-di-behavior-bundle/health.svg)](https://phpackages.com/packages/c33s-propel-di-behavior-bundle)
```

###  Alternatives

[nolimits4web/swiper

Most modern mobile touch slider and framework with hardware accelerated transitions

41.8k177.2k1](/packages/nolimits4web-swiper)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M259](/packages/laravel-dusk)[laravel/prompts

Add beautiful and user-friendly forms to your command-line applications.

712181.8M596](/packages/laravel-prompts)[cakephp/chronos

A simple API extension for DateTime.

1.4k47.7M121](/packages/cakephp-chronos)[laravel/pail

Easily delve into your Laravel application's log files directly from the command line.

91545.3M590](/packages/laravel-pail)[nette/bootstrap

🅱 Nette Bootstrap: the simple way to configure and bootstrap your Nette application.

68535.8M592](/packages/nette-bootstrap)

PHPackages © 2026

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