Weave 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
Easy Container

Easy Container Laravel Package

godruoyi/easy-container

godruoyi/easy-container is a lightweight PHP/Laravel service container that simplifies dependency injection, binding, and singleton management. Its small API makes registering and resolving services fast, clean, and easy to integrate into Laravel applications.

View on GitHub
Deep Wiki
Context7

A small PHP dependency injection container from Laravel Container, support PHP 5.3

Frequently asked questions about Easy Container
What is godruoyi/easy-container used for?
It is a small PHP dependency injection container derived from Laravel's container. It is used to simplify service binding, resolution, and singleton management in Laravel applications. Its goal is a fast, clean, lightweight API rather than a full replacement for Laravel's container.
How do I install godruoyi/easy-container in a Laravel app?
Install it with Composer, for example composer require godruoyi/easy-container. The technical evaluation indicates Laravel package auto-discovery and minimal configuration, so no complex setup is expected. For the 3.x line, confirm your project meets the PHP 8.1+ requirement before installing.
What PHP and Laravel versions does easy-container support?
The 3.0 release is reported to support PHP 8.1, so ^3.0 should be used on PHP 8.1 or later. It is intended for Laravel applications and should fit Laravel versions that support PHP 8.1, such as Laravel 8.x, 9.x, 10.x, and later according to the evaluation. Older releases may have different PHP constraints, so check composer.json for the exact version you install.
How do I bind and resolve services with easy-container?
The package provides a small API for registering services and resolving them from the container. Use its binding methods to register closures or class names, then resolve by the binding key; check the README for exact method names. In a Laravel app it is a thin convenience layer, so you can still use native helpers like app() and resolve() where appropriate.
Does godruoyi/easy-container support singleton services?
Yes, singleton management is part of the package's stated purpose. You can register a service as shared or singleton so repeated resolutions return the same instance. Confirm the exact singleton method syntax in the README for your installed version.
How is easy-container different from Laravel's built-in container?
easy-container is described as a small container from Laravel Container, offering a minimal API for binding and resolving services. Laravel's built-in container is the full framework container with broader features and framework integration. easy-container is a thin convenience layer, not a competing dependency injection paradigm.
How do I upgrade easy-container from 2.x to 3.x?
First ensure your application runs PHP 8.1 or later, because the 3.0 major release is reported to require it. Review the GitHub compare view and release notes for any API changes beyond the PHP version bump, since the changelog is sparse. Then update the Composer constraint to ^3.0 in a branch and run your full test suite before deploying.
Is godruoyi/easy-container safe for production use?
The technical risk is low because it is a small, thin wrapper over Laravel's container with no scaling implications. The main concerns are a single maintainer and limited changelog detail for the 3.0 release. Use it where it reduces boilerplate, test in staging, and keep native Laravel container calls as a low-cost fallback.
How should I test an application using easy-container?
Add the package in a development branch and run your application's existing test suite plus smoke tests for each service binding. Verify that bindings, singletons, and resolutions behave as expected after installation or upgrade. Composer will enforce the PHP 8.1+ constraint for 3.x, so confirm CI uses a compatible PHP version.
What are alternatives to easy-container if I do not need it?
Laravel's native app() and resolve() helpers or the framework's full container may already cover your dependency injection needs. Because easy-container is a thin wrapper, removing it has low exit cost if it is abandoned or unnecessary. For non-Laravel projects, evaluate a PSR-11 container instead, since the evaluation is unclear on PSR-11 support.
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.
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect