Giter Club home page Giter Club logo

embedi's People

Contributors

pmaselkowski avatar

Watchers

 avatar  avatar  avatar

embedi's Issues

Allow calling method instead of setting property

Config should allow calling method, also combined with component name, ie:

'setLogger()' => [
    'class' => Monolog\Monolog::class
];
// or
'@setLogger()' => 'logger';

Or some other syntax?

'setLogger@' => [
    'class' => Monolog\Monolog::class
];

Create managers interface

This should unify interface for SourceManager and (planned) AdaptersManager.

Methods setAdapters, addAdapters should be renamed to set/addManager(s).

Compound manager should be used to manage many managers sequentially.

NEW: Possibly outdated, as adapters seems to be enough

Add static `fly` method

Add static method:

EmbeDi::fly('instanceId')

which should create or return flyweight instance of EmbeDi

Add `addSource($config)` method

This should replace adapters.
This method should add configuration for classes to be used when requesting component.

$di = new EmbeDi();
$di->addSource([
'mangan' => [
'dbName' => 'foo'
]
])

new Mangan('mangan');// Will use config from source

Create adapters interface

This should allow easier integration with existing applications.
Adapter should point to configuration from external source.

Embedi should have method for setting adapter, ie.

setAdapter(IAdapter $adapter)

Or

addAdapter(IAdapter $adapter)

This sould allow loading config from several sources

Adapter interface:

IAdapter
{
    // This should return configuration array compatible
    getConfig($class, $instanceId);
}

Example for Yii

YiiAdapter implements IAdapter
{
    getConfig($class, $instanceId)
    {
        return Yii::app()->$instanceId;
    }
}

Add `get` method

This method should return named component instance based on config from Managers.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.