PHPackages                             franco2911/avresticontainer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. franco2911/avresticontainer

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

franco2911/avresticontainer
===========================

Lightweight and flexible Inversion of Control (IoC) container for PHP

1.0.1(2y ago)16MITPHPPHP ^8.3CI passing

Since Jun 25Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/fg-tec/avresticontainer)[ Packagist](https://packagist.org/packages/franco2911/avresticontainer)[ RSS](/packages/franco2911-avresticontainer/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (3)Versions (4)Used By (0)

AvrestiContainer
================

[](#avresticontainer)

[![PHP Composer](https://github.com/fg-tec/avresticontainer/actions/workflows/php.yml/badge.svg)](https://github.com/fg-tec/avresticontainer/actions/workflows/php.yml)

AvrestiContainer is a lightweight and flexible dependency injection (DI) container for PHP. It allows you to manage class dependencies and perform dependency injection in a simple and intuitive way.

Features
--------

[](#features)

- **Simple Binding**: Bind classes and interfaces to concrete implementations.
- **Singletons**: Register and resolve singletons easily.
- **Method Injection**: Inject dependencies into class methods.
- **Aliases**: Create aliases for bindings to simplify dependency resolution.
- **Dependency Resolution**: Automatically resolve and inject class dependencies.
- **Configurable Definitions**: Add multiple definitions in a single call using `addDefinitions`.
- **Autowiring**: Automatically resolve class dependencies without explicit bindings.

Installation
------------

[](#installation)

You can install AvrestiContainer via Composer:

```
composer require franco2911/avresticontainer
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

Here's a basic example of how to use AvrestiContainer:

```
require __DIR__ . '/vendor/autoload.php';

use Avresticontainer\Container;

$container = Container::getInstance();

$container->bind('config', function() {
    return new class {
        public function get($key) {
            return $key;
        }
    };
});

$config = $container->make('config');
echo $config->get('example_key');  // Outputs: example_key
```

### Using Singletons

[](#using-singletons)

Register and resolve singletons:

```
$container->singleton('config', function() {
    return new class {
        public $value = 'singleton_value';
    };
});

$config1 = $container->make('config');
$config2 = $container->make('config');

$config1->value = 'new_value';

echo $config2->value;  // Outputs: new_value
```

### Adding Definitions

[](#adding-definitions)

You can add multiple definitions using `addDefinitions`:

```
$container->addDefinitions([
    'config' => function() {
        return new Config(['db_host' => '127.0.0.1', 'db_name' => 'my_database']);
    },
    'database' => function($container) {
        return new DatabaseConnection($container->make('config'));
    },
    'simple.value' => 'This is a simple value'
]);

$config = $container->make('config');
$database = $container->make('database');
$simpleValue = $container->make('simple.value');
```

### Using Aliases

[](#using-aliases)

Create and use aliases for bindings:

```
$container->bind('original', function() {
    return new class {
        public function getValue() {
            return 'original value';
        }
    };
});

$container->alias('original', 'alias');

$original = $container->make('alias');
echo $original->getValue();  // Outputs: original value
```

### Autowiring

[](#autowiring)

AvrestiContainer can automatically resolve class dependencies:

```
class DependencyA {
    public function getValue() {
        return 'valueA';
    }
}

class DependencyB {
    protected $dependencyA;

    public function __construct(DependencyA $dependencyA) {
        $this->dependencyA = $dependencyA;
    }

    public function getDependencyValue() {
        return $this->dependencyA->getValue();
    }
}

$container->bind(DependencyA::class);
$container->bind(DependencyB::class);

$dependencyB = $container->make(DependencyB::class);
echo $dependencyB->getDependencyValue();  // Outputs: valueA
```

License
-------

[](#license)

This library is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

Contributing
------------

[](#contributing)

We welcome contributions! Please feel free to submit a pull request or open an issue on GitHub.

Acknowledgements
----------------

[](#acknowledgements)

Inspired by various PHP DI containers, AvrestiContainer aims to be a simple yet powerful tool for managing dependencies in PHP applications.

Contact
-------

[](#contact)

For any questions or inquiries, please create an issue on [GitHub](https://github.com/fg-tec/avresticontainer/issues).

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance53

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

739d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/53708871?v=4)[Franco Gaudiano](/maintainers/franco2911)[@Franco2911](https://github.com/Franco2911)

---

Top Contributors

[![Franco2911](https://avatars.githubusercontent.com/u/53708871?v=4)](https://github.com/Franco2911 "Franco2911 (4 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/franco2911-avresticontainer/health.svg)

```
[![Health](https://phpackages.com/badges/franco2911-avresticontainer/health.svg)](https://phpackages.com/packages/franco2911-avresticontainer)
```

###  Alternatives

[breadlesscode/neos-blog

Ready to use blog package

161.4k](/packages/breadlesscode-neos-blog)[edofre/yii2-slider-pro

Yii2 widget for slider-pro

112.7k](/packages/edofre-yii2-slider-pro)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
