Search by

projek-xyz / container

feryardiant

a dead-simple PSR-11 psr/container implementation with flexible service registration

Package info

github.com/projek-xyz/container

pkg:composer/projek-xyz/container

Fund package maintenance!

feryardiant

Statistics

Installs: 841

Dependents: 1

Suggesters: 0

Stars: 1

Open Issues: 0

v1.1.0 2026-05-16 12:34 UTC

This package is auto-updated.

Last update: 2026-10-14 08:36:54 UTC


README

Version License Actions Status Coverage Status SymfonyInsight Grade

Simple yet Flexible PSR-11 Container Implementation

This tiny library aims to provide a dead-simple PSR-11 implementation with flexible service registration.

Features

  • PSR-11 Compliant: Fully implements the PSR-11 ContainerInterface.
  • Autowiring: Automatically resolves dependencies for constructors and callables using type-hints or parameter names.
  • Flexible Registration: Register services using closures, class names, functions, invokable objects, or class-method pairs — pre-built instances go in through fn () => $instance or an EntryFactory.
  • Service Extension: Easily modify or wrap existing services using the extend() method.
  • On-the-fly Resolution: Build fresh, uncached values from a registered entry, a class name, or any callable using make() — nothing is stored and no events fire.
  • PSR-14 Event Lifecycle: Dispatches readonly, observe-only EntryRegistered and EntryResolved events through PSR-14 interfaces, with a minimalist built-in dispatcher for zero-config ContainerAware injection.
  • Container Awareness: Automatically inject the container into services that implement ContainerAware.
  • Lightweight: Minimal dependencies (only PSR-11 and PSR-14 interfaces) and a small footprint.

Installation

Use Composer

$ composer require projek-xyz/container --prefer-dist

Documentation

Documentations and usages available on wiki

License

This library is open-sourced software licensed under MIT license.