Skip to main content

A small dependency injection container based on Symfony2 Dependency Component

Project description

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')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ioc-0.0.16.tar.gz (159.2 kB view details)

Uploaded Source

File details

Details for the file ioc-0.0.16.tar.gz.

File metadata

  • Download URL: ioc-0.0.16.tar.gz
  • Upload date:
  • Size: 159.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ioc-0.0.16.tar.gz
Algorithm Hash digest
SHA256 b1f2bf5ace965eda5c9bd8450a506cbaa55ef83148ba9bf305d91153e7739002
MD5 d8dad096038a8b366557a43d924c6faf
BLAKE2b-256 a593be89b8908ae6170c4eeb2241b26e46e61a3ad5266c19e48d3fa05976a38a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page