Skip to content

AnalyzePHP/Container

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 

Analyze PHP Container

This is the default container used in the Analyze PHP Framework. It is PSR-11 compatable.

Installation

Requirements

PHP >= 7.0.0

Via Composer

Installation via Composer is the recommended method of installation.

Basic Usage

<?php

use Analyze\Container\Container;

// Create a new Container instance
$container = new Container;

// Add via Factory
$this->addFactory('AwesomePackage', function() {
    return new Some\Awesome\Package;
});

// Add via Constructor
$this->addClass('AwesomePackage', Some\Awesome\Package::class);

// Add via Setter
$this->addSetter('AwesomePackage', 'Some\Awesome\Package', [
    'setName' => 'Bob'
]);

// Return a new instance
$awesome = $container->get('AwesomePackage');

About

The IoC container used in the Analyze Framework. You can use it too!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages