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

league/container is a lightweight PSR-11 dependency injection container for PHP. Define entries, factories, and autowiring-friendly services to manage application dependencies cleanly, with modern PHP support and solid tooling for testing and analysis.

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.
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi