Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-10739

Dependency Injection Container

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Major Major
    • 3.1.0-a1
    • 3.1.0-dev
    • None
    • None

      Since we started using Dependency Injection we have lots of decoupled classes that can be unit tested. That's great. However, assembling these classes is a pain, as you can see by looking at common.php. There's a lot of boilerplate needed. Worse, this is duplicated across common.php, download/file.php, the installer.

      We could solve that by using a Dependency Injection Container, or DIC (worst acronym ever). The DIC knows about all services, and how to create them. Whenever you request a service, it will create it on the fly, including any service that it depends on.

      Configuration of these services takes place in a static YAML file (could also be XML, TXT, INI or plain PHP).

      The Symfony2 DependencyInjection component provides such a container that is pretty much standalone. By adding the YAML and Config components (optional dependencies of DependencyInjection) we can make it even easier to use.

      Tying that into phpBB should be quite easy, and allow us to reduce boilerplate.

            igorw Igor Wiedler [X] (Inactive)
            igorw Igor Wiedler [X] (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: