Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Container Laravel Package

league/container

PSR-11–compliant dependency injection container from The PHP League. Register services, factories and shared instances, then resolve dependencies with autowiring support. Modern PHP (8.3+) with full docs, tests, and MIT license.

View on GitHub
Deep Wiki
Context7

layout: post title: Auto Wiring sections: Introduction: introduction Usage: usage

Introduction

The ReflectionContainer supports two modes, which can be enabled or disabled using the mode property:

  • ReflectionContainer::AUTO_WIRING — Enables auto wiring (resolving dependencies by type-hint).
  • ReflectionContainer::ATTRIBUTE_RESOLUTION — Enables attribute-based resolution (using attributes like #[Inject] or #[Resolve]).

Usage

By default, both modes are enabled. You can control them like this:

<?php 

use League\Container\ReflectionContainer;

// Enable only auto wiring (disable attribute resolution)
$container->delegate(
    new ReflectionContainer(
        cacheResolutions: false,
        mode: ReflectionContainer::AUTO_WIRING
    )
);

// Enable only attribute resolution (disable auto wiring)
$container->delegate(
    new ReflectionContainer(
        cacheResolutions: false,
        mode: ReflectionContainer::ATTRIBUTE_RESOLUTION
    )
);

// Enable both (default)
$container->delegate(
    new ReflectionContainer()
);

// Change mode at runtime
$reflectionContainer = new ReflectionContainer();
$reflectionContainer->setMode(ReflectionContainer::AUTO_WIRING);
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport