PSR-11 compatible Dependency Injection Container for PHP.

Overview

bitexpert/disco

This package provides a PSR-11 compatible, annotation-based dependency injection container. Have a look at the disco-demos project to find out how to use Disco.

Build Status Coverage Status

Installation

The preferred way of installing bitexpert/disco is through Composer. You can add bitexpert/disco as a dependency, as follows:

composer.phar require bitexpert/disco

Usage

To instantiate Disco use the following code in your bootstrapping logic. Create an instance of the \bitExpert\Disco\AnnotationBeanFactory and register the instance with the \bitExpert\Disco\BeanFactoryRegistry. The second step is important as Disco needs to grab the active container instance in a few locations where it does not have access to the container instance itself.

<?php

$beanFactory = new \bitExpert\Disco\AnnotationBeanFactory(MyConfiguration::class);
\bitExpert\Disco\BeanFactoryRegistry::register($beanFactory);

Next up you need to create a configuration class MyConfiguration and document it with a @Configuration annotation.

<?php

use bitExpert\Disco\Annotations\Configuration;

/**
 * @Configuration
 */
class MyConfiguration
{
}

To declare a configuration entry, 1) add a method to your MyConfiguration class, and 2) annotate the method with the @Bean annotation. Doing this registers the instance with Disco and uses the type specified by the method’s return value. The primary identifier is the method name:

<?php

use bitExpert\Disco\Annotations\Bean;
use bitExpert\Disco\Annotations\Configuration;
use bitExpert\Disco\Helper\SampleService;

/**
 * @Configuration
 */
class MyConfiguration
{
    /**
     * @Bean
     */
    public function mySampleService() : SampleService
    {
        return new SampleService();
    }
}

To let Disco return the entry with the id mySampleService call the get() method of \bitExpert\Disco\AnnotationBeanFactory, as follows:

<?php

$beanFactory->get('mySampleService');

Documentation

Documentation is in the docs tree, and can be compiled using bookdown.

$ php ./vendor/bin/bookdown docs/bookdown.json
$ php -S 0.0.0.0:8080 -t docs/html/

Then point your browser to http://localhost:8080/

Contribute

Please feel free to fork and extend existing or add new features and send a pull request with your changes! To establish a consistent code quality, please provide unit tests for all your changes and adapt the documentation.

Want To Contribute?

If you feel that you have something to share, then we’d love to have you. Check out the contributing guide to find out how, as well as what we expect from you.

Resources

License

Disco is released under the Apache 2.0 license.

Comments
  • [Feature ]Automatically generate alias from return type declaration

    [Feature ]Automatically generate alias from return type declaration

    Given you have bean method configuration that looks like this:

    /** @Bean({"alias" = "\My\Namespace\Service\ProductService"}) */
    public function productService() : \My\Namespace\Service\ProductService
    {
        return new \My\Namespace\Service\DefaultProductService();
    }
    

    The configured alias matches the return type definition - in this case either the name of an interface or a parent class. Since the alias is a hard-coded string it won't get updated during the usual refactorings (moving files to a different namespace and such) which is not what we want.

    It would be nice to provide a sepcial keyword to let Disco automatically determine the return type declaration during the cached configuration generation process and automatically use the return type declaration as an alias, e.g.

    /** @Bean({"alias" = "type"}) */
    public function productService() : \My\Namespace\Service\ProductService
    {
        return new \My\Namespace\Service\DefaultProductService();
    }
    

    That way I could access the bean like this:

    $beanFactory->get('\My\Namespace\Service\ProductService');
    
    enhancement help wanted 
    opened by shochdoerfer 10
  • Rising Code Coverage for Disco to 100%

    Rising Code Coverage for Disco to 100%

    This PR covers one step of #94: Getting 100% code coverage. I also made a few tests stricter.

    During my work, I realized, that in its integration, there is still a possible unreachable code in Disco. In BeanMethod::generateMethod(), there is a else-block which can be tested when it is handled as a unit.

    The method itself is only used in ConfigurationGenerator at line 167. But before it's invoked, the same checks as in BeanMethod::generateMethod() are also done in ConfigurationGenerator, which happens at line 150. It looks like the BeanMethod::generateMethod() else-block never can be reached during Disco's runtime.

    Should I remove the else-block and its newly added test?

    opened by SenseException 9
  • Allow overwriting an Alias in an extending class

    Allow overwriting an Alias in an extending class

    Currently Disco throws an exception when it finds an already declared alias. That is totally valid as long as the configuration is done in one single file.

    As soon as you want to have a configuration split over different files that becomes complicated as you can not overwrite an alias that was declared in the base class within an extending class.

    Given I want a configuration for my production system with an alias for a logger and I then want to extend that configuration for my dev-environment and want to implement a different logger.

    Currently I need to create three classes. One base class with all the configs that will never change and one class for production config extending the base class and implementing all the aliases that will change between prod and dev. And I also create another config for the dev-counterpart of those changing aliases.

    This commit allows to overwrite aliases in extending files only. So I can create my configuration for production and for dev I can extend that base class and overwrite the aliases I need to adapt.

    This change should be absolute BC, no tests where adapted, only added.

    opened by heiglandreas 7
  • Allow protected methods to be ignored

    Allow protected methods to be ignored

    When you want to extend a global configuration with a configuration for prod or dev-environment you might need to decalre a formerly private method with protected visibility. As that up until now required a method to have a Bean annotation that was actually not possible.

    This Commit introduces a method-annotation "@Ignore" to mark protected methods to be ignored as Bean-methods

    opened by heiglandreas 7
  • Rising Code Coverage for Disco

    Rising Code Coverage for Disco

    Currently, Disco has a code coverage of ~95%, but most of its coverage happened by hardcoded instance creations over bitExpert\Disco\AnnotationBeanFactory and bitExpert\Disco\AnnotationBeanFactoryUnitTest. In case of possible refactorings, does it make sense to add coverage by testing every class' methods separated in custom unit tests?

    And why 100% code coverage?

    I started to take a look into the uncovered code and asked myself if there may be unreachable code by writing tests.

    For example: https://github.com/bitExpert/disco/blob/v0.8.0/src/bitExpert/Disco/BeanFactoryConfiguration.php#L146

    if (!spl_autoload_register($this->proxyAutoloader, false)) {
        throw new RuntimeException(
            sprintf('Cannot register autoloader "%s"', get_class($this->proxyAutoloader))
        );
    }
    

    spl_autoload_register can return false in cases of an error, like using a function name, that doesn't exist, in form of a string, but I didn't find a way to make this fail with a callable autoloader class using __invoke(). I haven't try the same for spl_autoload_unregister yet, but I expect the same like in spl_autoload_register.

    opened by SenseException 7
  • [WIP] Extract the docs out into a new documentation structure

    [WIP] Extract the docs out into a new documentation structure

    This PR:

    • begins the creation of a self-sustaining documentation structure for the project. The README can then be dedicated to providing a project introduction/overview and a table of contents (of sorts).
    opened by settermjd 7
  • Add a Contributing Guide

    Add a Contributing Guide

    This PR:

    • adds instructions showing how to contribute to the project.

    :information_desk_person: As part of the overhaul of the documentation, I want to make it as easy as possible for others to know how to contribute to the project.

    opened by settermjd 7
  • Check if Disco can be installed on PHP 7.2 and latest ProxyManager version

    Check if Disco can be installed on PHP 7.2 and latest ProxyManager version

    Make sure that the current version of Disco can be installed on PHP 7.2. Also check for side-effects with the latest version of ProxyManager which is focused PHP 7.2 only.

    opened by shochdoerfer 5
  • Allow multiple aliases per bean and add return type aliases

    Allow multiple aliases per bean and add return type aliases

    Resolves #74

    Implementation is very close to what we've discussed in the issue, except that I use a single @Alias for named and for return type aliases. It makes the implementation simpler ("aliases" attribute of bean can be a collection).

    Like noted in the issue: the PR introduces a BC break

    opened by codeliner 5
  • Improve README file

    Improve README file

    Optimize the README.md file to make it easier for beginners to get started. In addition I would love to see the following changes:

    • add a rationale to explain why Disco makes sense and why/how it is different to the other DI containers in PHP
    • highlight the different use-cases that can be solved with Disco
    • highlight the different ways of injecting dependencies e.g. constructor injection, setter injection, interface injection
    • improve the documentation of the bean configuration settings and how they affect each other
    • fix some typos ;)
    help wanted documentation 
    opened by shochdoerfer 5
  • Handle

    Handle "special" chars in the identifiers

    While experimenting with Disco and Expressive I realized that currently Disco is not able to work with Expressive for one reason: Expressive uses pseudo class names to query service instances from the service container. Since Disco tries to call a method with the same name on the config class this currently does not work because "" is not a valid character to be used for a method name.

    To solve the issue we need a mapper in between to translate the invalid characters into valid ones.

    opened by shochdoerfer 5
  • Rewrite using native Attributes instead of annotations.

    Rewrite using native Attributes instead of annotations.

    This is an implementation of #131

    Changes

    Bean

    #[Configuration]
    class X
    {
        #[Bean(
            singleton: true, 
            lazy: true, 
            scope: Bean::SCOPE_SESSION
        )]
        public function serviceDefinition(): Service {}
    }
    

    Use the Bean attribute to define a bean and set their singleton, lazy or scope option. Use the Parameter and Alias attribute to define parameters and aliases.

    Alias

    #[Configuration]
    class X
    {
        #[Bean]
        #[Alias(name: 'my.service.id')]
        #[TypeAlias]
        public function serviceDefinition(): SomeService { /* .... */ }
    }
    

    The purpose of the Alias attribute is to define a named alias. The name must be at least 1 character of length. To define the return type as an alias use #[TypeAlias]. Multiple Alias attribute are allowed, only 1 TypeAlias. Both Alias and TypeAlias only affect Bean definitions.

    BeanPostProcessor

    #[Configuration]
    class X
    {
        #[BeanPostProcessor]
        public function beanPostProcessor(): MyPostProcessor { /* .... */ }
    }
    

    To define a bean post processor apply #[BeanPostProcessor] attribute. Add #[Parameter] attributes to define parameters.

    Parameter

    #[Configuration]
    class X
    {
        #[BeanPostProcessor]
        #[Parameter(
            key: 'configKey',
            name: 'argName',
            default: 'some default value',
            required: false,
        )]
        public function beanPostProcessor(string $argName): MyPostProcessor { /* .... */ }
    
        #[Bean]
        #[Parameter(
            key: 'configKey',
            name: 'secondArg',
            default: 'some default value',
            required: false,
        )]
        #[Parameter(key: 'otherConfigKey', name: 'secondArg')]
        public function serviceDefinition(string $configValue, int $secondArg): MyPostProcessor { /* .... */ }
    }
    

    Attribute a Bean or BeanPostProcessor with 1 or multiple Parameter attributes. key used to look up the value in the configuration array. :warning: This is the equivalent of name in 0.x version. name has now a different purpose: name corresponds with the name of argument of the method definition. default and required act the same as in 0.x.

    Disco will use the feature named arguments of PHP 8, to pass the arguments to the method call.

    About positional parameters

    At this moment the name option is not mandatory. When omitted the Parameter becomes a positional argument. Disco will pass positional arguments to the method function followed by the named arguments as required by PHP, see Example #16.

    The mutual order of the positional parameters is of course important.

    The base line is that the same rules and restrictions apply as when using and mixing named and positional arguments when calling the method yourself. Read more about it the PHP docs.

    To be discussed

    Builtin types as return type alias

    In 0.x it was possible to define the return type alias when the actual return type was a builtin type like string, int, float, bool, array, object, callable or iterable. This is now not possible anymore. An exception will be thrown. An example of an invalid configuration:

    #[Configuration]
    class X
    {
        #[Bean]
        #[TypeAlias]
        public function serviceDefinition(): callable { /* .... */ }
    }
    

    Parameter validation

    At compile time, should we validate configured parameters with the method signature? Possible validations:

    • name option van the Parameter should correspond with the name of one of the arguments
    • multiple Parameters with the same name should not be allowed
    • a bit more advanced: named Parameter should not correspond with an argument that's covered by a positional Parameter
    • when argument in the method signature has no default value, the parameter should have a default value or be required...

    Anything else?

    opened by netiul 14
  • PHP 8 and attributes

    PHP 8 and attributes

    With PHP 8 and having attributes support, configuring beans can be even more simpler. I don't expect to have a complete picture of what's needed, since I have only experience with discolight where I did this proposal (sort of). Anyway here's my take:

    There are some options to walk this path:

    1. Add support to the 0.x major versioning line
    2. Replace configuration by annotation with attributes which of course would require a major version release: 1.x

    I can't think of a good reason to go for option 2. Adding it to 0.x allows for a gradual upgrade path allowing to deprecate features which can eventually be removed in 1.x.

    Adding this feature can be done by:

    1. add support to current Annotation classes, or
    2. creating new Attribute classes.

    While new Attribute classes allows you to start with a clean slate, current Annotation classes can quite easily be adapted in order to be used as Attribute classes as well.

    As option 1 is in my opinion the most valuable approach I'll go a bit further on that:

    Add support to current Annotation classes

    Example of how that can be achieved in case of the Alias class:

    /**
     * @Annotation
     * @Target({"ANNOTATION"})
     * @Attributes({
     *   @Attribute("name", type = "string"),
     *   @Attribute("type", type = "bool"),
     * })
     */
    #[\Attribute(\Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
    final class Alias
    {
        /**
         * @var string
         */
        private $name;
    
        /**
         * @var bool
         */
        private $type;
    
        /**
         * Creates a new {@link \bitExpert\Disco\Annotations\Bean\Alias}.
         *
         * @param array $attributes
         * @throws AnnotationException
         */
        public function __construct(array $attributes = [], ?string $name = null, bool $type = false)
        {
            // When configured by annotations the $attributes['value'] is not empty, so
            // in that case override the $name and $type variables from the $attributes['value'] array.
            if (!empty($attributes['value'])) {
                $attributes = $attributes['value'];
                // Assign local variables the value from $attributes meanwhile making sure the keys exist
                // with at least the default value as defined in the constructor.
                ['name' => $name, 'type' => $type] = $attributes + ['name' => $name, 'type' => $type];
            }
    
            if (!is_bool($type)) {
                $type = AnnotationAttributeParser::parseBooleanValue($type);
            }
    
            if ($type && $name) {
                throw new AnnotationException('Type alias should not have a name!');
            }
    
            if (!$type && !$name) {
                throw new AnnotationException('Alias should either be a named alias or a type alias!');
            }
    
            $this->type = $type;
            $this->name = $name;
        }
    
        public function getName(): ?string
        {
            return $this->name;
        }
    
        public function isTypeAlias(): bool
        {
            return $this->type;
        }
    }
    
    class Config
    {
        /**
         * Using named arguments
         */
        #[Bean]
        #[Alias(type: true)]
        #[Alias(name: 'my.service.id')]
        public function myService(): Service
        {}
    
        /**
         * Using ordered arguments
         */
        #[Bean]
        #[Alias([], null, true)]
        #[Alias([], 'my.service.id')]
        public function myOtherService(): OtherService
        {}
    }
    

    As you can see named arguments allow for a clean usage of existing Annotation classes.

    What about nested attributes? In PHP's current implementation of attributes nesting is not supported, so explicitly configuring needs to be done on the same level, or instances of nested attributes/annotations should be able to be configured with scalars and instantiated in the "parent" attribute instance.

    class Config {
        #[Bean(aliases: [
            ['type' => true],
            ['name' => 'my.service.id'],
        ])]
        public function myService(): Service
        {}
    }
    

    What does this means for each type of annotation?

    Alias Allow configuration of

    • name
    • type

    Bean Allow configuration of

    • scope
    • singleton
    • lazy
    • aliases discouraged, use (multiple) Alias attributes instead
    • parameters discouraged, use (multiple) Parameter attributes instead

    BeanPostProcessor Allow configuration of

    • parameters discouraged, use (multiple) Parameter attributes instead

    Configuration Just an identifier attribute

    Parameter The ordering of parameters is important since the method is called with the parameters in the order they are configured. Nesting the parameters inside the Bean annotation provides a natural way of respecting the ordering of the arguments in the methods signature. But requiring attributes to be listed in a specific order feels a bit like a smell to me.

    class Config {
        #[Bean(parameters: [
            ['name' => 'config.key1', 'default' => 'default value'],
            ['name' => 'config.key2', 'default' => 'other default value'],
        ])]
        public function myService($key1, $key2): Service
        {}
    
        // Correct ordering of the parameter attributes required, NOT IDEAL
        #[Bean]
        #[Parameter(name: 'config.key1', default => 'default value')]
        #[Parameter(name: 'config.key2', default => 'other default value')]
        public function myOtherService($key1, $key2): OtherService
        {}
    }
    

    Possible solution: When using the Parameter attribute, require a config key with the name of the argument so it can be used for calling the method with named arguments. The nicest would be something like this:

    $parameters = [
        'config' => [
            'key1' => 'value of key1',
            'key2' => 'value of key2',
        ],
    ];
    class Config {
        #[Bean]
        #[Parameter(name: 'arg2', key: 'config.key2', default => 'other default value')]
        #[Parameter(name: 'arg1', key: 'config.key1', default => 'default value')]
        public function myService($arg1, $arg2): Service
        {
            // $arg1 = 'value of key1;
            // $arg2 = 'value of key2;
        }
    }
    

    Unfortunately name is already in use as the name of the parameter key, but i.e. argname can perhaps be a good alternative.

    How to incorporate this with the ConfigurationGenerator?

    The doctrine AnnotationReader can be swapped out for a FallbackAttributeReader. The FallbackAttributeReader would prioritize attributes over Annotations.

    I would not recommend mixing annotations and attributes on the same level.

    Possible guidelines:

    • When the Bean attribute is found on a method ignore any annotations.
    • When the Bean attribute is found on a method look for Alias and Parameter attributes.
    • When the Bean attribute has nested aliases prioritize these over configured Alias attributes.
    • When the Bean attribute has nested parameters prioritize these over configured Parameter attributes.
    • When the BeanPostProcessor attribute is found on a method ignore any annotations.
    • When the Configuration attribute is found on a method ignore any annotations.
    opened by netiul 12
  • Disco-Docs as github-pages

    Disco-Docs as github-pages

    As disco is already hosted on github, wouldn't it be a great idea to serve the disco-documentation (that is currently only available via a local server) via github pages?

    AFAIK that would require enabling the github-pages for the repo and setting the source to the docs-folder. Everything else should then work out from scratch. Probably linking the different pages needs to be taken care of.

    Alternative would be to use the existing bookdown-setup to create the docs and deploy them to github pages…

    opened by heiglandreas 2
  • [Feature] Disco should be able to autowire bean instances

    [Feature] Disco should be able to autowire bean instances

    As discussed with @Ocramius today it would make sense for Disco to be able to support autowiring for bean instances to reduce the amount of configuration code needed and to be able to get rid of traits for structuring the configuration code.

    The following configuration:

    /** @Bean */
    protected function database() : Database
    {
        return new Database('mysql://user:secret@localhost/mydb');
    }
    
    /** @Bean */
    public function productService() : ProductService
    {
        return new ProductService($this->database());
    }
    

    could then be simplified like this:

    /** @Bean */
    protected function database() : Database
    {
        return new Database('mysql://user:secret@localhost/mydb');
    }
    
    /** @Bean */
    abstract public function productService() : ProductService;
    

    At a later stage we could move the methods into separate interfaces - to be able to get rid of the abstract keyword and ultimately get rid of the trait approach.

    A few problems need to be solved:

    • [ ] When using interfaces as configuration source, how to cope with method naming clashes?
    • [ ] When there are multiple database instances available how would Disco decide which one to use? We would need a way to pass the method name or alias name to the bean configuration of the ProductService.
    • [ ] For Constructor Injection things are simple, but to be able to decide which methods needs to be called for Setter Injection we might need annotations on the setter methods of the class. So far the goal of Disco was to keep annotations just in the configuration class. Maybe we can solve this differently?
    • [ ] How to cope with primitive values that should be injected? Maybe we could rely on the same naming scheme - e.g. when the parameter of the bean definition method is called $dsn we check if the class has a parameter with that name as constructor argument, same for the setter methods.
    • [ ] For primitives we obviously need to skip the whole injection logic.
    • [ ] When adding this feature it might make sense to enable the production autoloader of Proxy Manager by default as the constant parsing could slow things down quite a bit.
    opened by shochdoerfer 3
  • [Feature] Let Disco also generate the phpstorm Meta file for type lookups

    [Feature] Let Disco also generate the phpstorm Meta file for type lookups

    PhpStorm supports a so-called Meta file helping with autocompletion for container calls. Add a (Phing) task to generate such a file for the given container configuration to enable autocomplete support for the return values of the BeanFactory::get() calls.

    opened by shochdoerfer 6
Releases(v0.10.0)
  • v0.10.0(Mar 18, 2018)

    Added

    • #117 Allow overwriting an Alias in an extending class
    • #115 Missing types for Disco methods
    • #106 Add "provide" section to composer.json
    • #92 Revise the documentation

    Deprecated

    • #114 Bump php version to 7.2

    Removed

    • Nothing.

    Fixed

    • #113 Move vfsstream dependency to require-dev section
    • #109 Replace annotations with methods for exception tests
    • #107 Add test for invalid service alias names
    • #104 Php Inspections (EA Extended): nit-picks

    Thank you @SenseException, @kalessil and @heiglandreas for your contributions to this exceptional release ;)

    Source code(tar.gz)
    Source code(zip)
  • v0.9.0(Jun 15, 2017)

    Added

    • #101 Allow parameters in BeanPostProcessor configuration
    • #100 Convert @Parameters annotation to "parameters" attribute of @Bean annotation
    • #99 Allow multiple aliases per bean and add return type aliases
    • #97 Fix of markdown for "Sending a PR" headline
    • #93 Enable coveralls support
    • #91 Remove the develop branch references from the contribution guide
    • #89 Update to PHPUnit 6
    • #82 Add bookdown docs and restructure main README.md file

    Deprecated

    • #102 Remove BeanFactoryPostProcessor
    • #95 Upgrade to ProxyManager 2.1.x to allow to set the minimum PHP version to 7.1

    Removed

    • Nothing.

    Fixed

    • Nothing.

    Big thanks to @codeliner and @SenseException for working on this release!

    Source code(tar.gz)
    Source code(zip)
  • v0.8.0(Feb 14, 2017)

  • v0.7.0(Feb 11, 2017)

    0.7.0

    Added

    • #81 Generate unique names for helper methods
    • #80 Adds setup for simple benchmarks
    • #78 Optimize the code formatting of the generated config class
    • #73 Benchmark Disco and add results to README

    Deprecated

    • Nothing.

    Removed

    • #77 Change in Travis config: Remove hhvm, add PHP 7.1 to build matrix

    Fixed

    • #76 Change visibility of wrapBeanAsLazy helper method to protected
    • #69 Use UniqueIdentifierGenerator::getIdentifier to generate unique names for helper methods
    • #68 Change visibility of wrapBeanAsLazy helper method
    • #66 APC fix as suggested by Scrutinizer
    Source code(tar.gz)
    Source code(zip)
  • v0.6.3(Jan 8, 2017)

  • v0.6.2(Jan 7, 2017)

  • v0.6.1(Jan 7, 2017)

  • v0.6.0(Nov 8, 2016)

    Added

    • #65 Restructure the bean method code generator

    Deprecated

    • Nothing.

    Removed

    • #64 Remove Doctrine Cache dependency
    • #63 Remove type check code in generated class.

    Fixed

    • #61 Check given $id for being a non-empty string
    Source code(tar.gz)
    Source code(zip)
  • v0.5.0(Sep 1, 2016)

    Added

    • #55 Introducing aliases for Beans
    • #53 Switched to PHP_EOL.
    • #52 Primitive types can be returned from the bean methods.
    • #49 Upgraded ProxyManger to version 2.x and dropped support for PHP 5.x.

    Deprecated

    • Nothing.

    Removed

    • Nothing.

    Fixed

    • #59 Session refactoring
    • #56 Fixed an issue with the serialization of the BeanFactory instance.
    • #51 Fixed $reader property type hint.
    • #50 Added null check in BeanFactoryPostProcessor.
    Source code(tar.gz)
    Source code(zip)
  • v0.4.0(Aug 7, 2016)

    Added

    • #40 Check bean return type against return type annotation.
    • #37 Editing README

    Deprecated

    • Nothing.

    Removed

    • #41 Removed FactoryBean interface as it does not make sense any more.

    Fixed

    • #38 has() returns true for internal dependencies.
    Source code(tar.gz)
    Source code(zip)
  • 0.10.0(Mar 18, 2018)

    Added

    • #117 Allow overwriting an Alias in an extending class
    • #115 Missing types for Disco methods
    • #106 Add "provide" section to composer.json
    • #92 Revise the documentation

    Deprecated

    • #114 Bump php version to 7.2

    Removed

    • Nothing.

    Fixed

    • #113 Move vfsstream dependency to require-dev section
    • #109 Replace annotations with methods for exception tests
    • #107 Add test for invalid service alias names
    • #104 Php Inspections (EA Extended): nit-picks

    Thank you @SenseException, @kalessil and @heiglandreas for your contributions!

    Source code(tar.gz)
    Source code(zip)
Owner
bitExpert AG
Grundprinzip & Erfolgsformel: Innovation, Qualität & Professionalität dank einem motivierten & erfahrenen Team. Impressum: https://www.bitexpert.de/kontakt/
bitExpert AG
A small PHP dependency injection container

Pimple Caution! Pimple is now closed for changes. No new features will be added and no cosmetic changes will be accepted either. The only accepted cha

Silex 2.6k Dec 29, 2022
💎 Flexible, compiled and full-featured Dependency Injection Container with perfectly usable autowiring and support for all new PHP 7 features.

Nette Dependency Injection (DI) Introduction Purpose of the Dependecy Injection (DI) is to free classes from the responsibility for obtaining objects

Nette Foundation 781 Dec 15, 2022
🚀 PHP Service Container with fast and cachable dependency injection.

ClanCats Container A PHP Service Container featuring a simple meta-language with fast and compilable dependency injection. Requires PHP >= 7.0 Pros: M

ClanCats 28 Apr 13, 2022
Twittee is the smallest, and still useful, Dependency Injection Container in PHP

What is Twittee? Twittee is the smallest, and still useful, Dependency Injection Container in PHP; it is also probably one of the first public softwar

null 133 Dec 5, 2022
The dependency injection container for humans

layout home PHP-DI is a dependency injection container meant to be practical, powerful, and framework-agnostic. Read more on the website: php-di.org G

null 2.4k Jan 4, 2023
Small but powerful dependency injection container

Container (Dependency Injection) This package is compliant with PSR-1, PSR-2, PSR-4 and PSR-11. If you notice compliance oversights, please send a pat

The League of Extraordinary Packages 779 Dec 30, 2022
Dependency Injection System

Aura.Di A serializable dependency injection container with constructor and setter injection, interface and trait awareness, configuration inheritance,

Aura for PHP 342 Dec 1, 2022
DI Container (PSR-11)

My DI Container It's my own implementation PSR-11 Container Interface. Installation composer require scruwi/container Init $container = new Container(

null 4 Mar 15, 2022
This repository holds all interfaces related to PSR-11 (Container Interface).

Container interface This repository holds all interfaces related to PSR-11 (Container Interface). Note that this is not a Container implementation of

PHP-FIG 9.6k Jan 4, 2023
Dependency Manager for PHP

Composer - Dependency Management for PHP Composer helps you declare, manage, and install dependencies of PHP projects. See https://getcomposer.org/ fo

Composer 27.2k Dec 31, 2022
IoC Dependency Injector

auryn auryn is a recursive dependency injector. Use auryn to bootstrap and wire together S.O.L.I.D., object-oriented PHP applications. How It Works Am

Daniel Lowrey 725 Nov 23, 2022
IoC Dependency Injector

auryn auryn is a recursive dependency injector. Use auryn to bootstrap and wire together S.O.L.I.D., object-oriented PHP applications. How It Works Am

Daniel Lowrey 710 Apr 15, 2021
Extensible DI container for Symfony2

This package contains an implementation of the Symfony 2 DI container that can be extended using other DI containers (from other frameworks).

TheCodingMachine 1 Apr 2, 2014
Adapters for PHP framework containers to an interoperable interface

Acclimate - Container Adapters Get Acclimated! Use any third-party dependency injection containers and service locators in your code by adapting them

Acclimate Container 215 Dec 16, 2022
Yii Dependency Injection PSR-11 compatible

Yii Dependency Injection PSR-11 compatible dependency injection container that is able to instantiate and configure classes resolving dependencies. Fe

Yii Software 161 Nov 10, 2022
A small PHP dependency injection container

Pimple Caution! Pimple is now closed for changes. No new features will be added and no cosmetic changes will be accepted either. The only accepted cha

Silex 2.6k Dec 29, 2022
💎 Flexible, compiled and full-featured Dependency Injection Container with perfectly usable autowiring and support for all new PHP 7 features.

Nette Dependency Injection (DI) Introduction Purpose of the Dependecy Injection (DI) is to free classes from the responsibility for obtaining objects

Nette Foundation 781 Dec 15, 2022
🚀 PHP Service Container with fast and cachable dependency injection.

ClanCats Container A PHP Service Container featuring a simple meta-language with fast and compilable dependency injection. Requires PHP >= 7.0 Pros: M

ClanCats 28 Apr 13, 2022
Twittee is the smallest, and still useful, Dependency Injection Container in PHP

What is Twittee? Twittee is the smallest, and still useful, Dependency Injection Container in PHP; it is also probably one of the first public softwar

null 133 Dec 5, 2022
The dependency injection container for humans

layout home PHP-DI is a dependency injection container meant to be practical, powerful, and framework-agnostic. Read more on the website: php-di.org G

null 2.4k Jan 4, 2023