Skip to content

v1.0.1 FlightPHP Dependency Injection Container

Choose a tag to compare

@fadrian06 fadrian06 released this 10 Mar 00:49
· 13 commits to main since this release

FlightPHP Container

A lightweight Dependency Injection Container (DIC) for PHP, to manage and streamline object dependencies effectively.

Features

  • Lightweight and Efficient: Manage dependencies with ease.
  • Flexible Configuration: Easily integrate with various PHP applications.
  • PSR-11 Compliance: Ensures interoperability between containers.

It resolve automatically for you:

  • Classes without constructor.
  • Classes without constructor parameters.
  • Class dependencies with default constructor parameters.

If flight/Container cannot resolve your dependency, you can set:

  • An interface to an implementation.
  • A complex object instantiation, passing a callable to
use flight\Container

$container = new Container;

$container->get(MyComplexObject::class, fn(Container $container): MyComplexObject => new MyComplexObject(
  // ... constructor parameters
));

Implement Dependency Inversion Principle in your projects easily with flight\Container

Full Changelog: v1.0.0...v1.0.1