skip to navigation
skip to content

Not Logged In

ioc 0.0.15

A small dependency injection container based on Symfony2 Dependency Component

This project is a simple port of the Symfony2 DependencyInjection lib available at https://github.com/symfony/DependencyInjection

Status: Work In Progress

Usage

  • Create a services.yml file, the file will contains different service definiton such as
parameters:
    foo.bar: argument 1

services:
    fake:
        class: tests.ioc.service.Fake
        arguments:
            - "%foo.bar%"
        kargs:
            param: here a parameter
        calls:
             - [ set_ok, [ false ]]
             - [ set_ok, [ true ], {arg2: "arg"} ]

    foo:
        class: tests.ioc.service.Foo
        arguments: ["@fake", "#@weak_reference"]
        kargs: {}

    weak_reference:
        class: tests.ioc.service.WeakReference

Then to use and access a service just do

import ioc

container = ioc.build(['services.yml'])

foo = container.get('foo')
 
File Type Py Version Uploaded on Size
ioc-0.0.15.tar.gz (md5) Source 2013-09-08 117KB
  • Downloads (All Versions):
  • 7 downloads in the last day
  • 126 downloads in the last week
  • 466 downloads in the last month