technically/array-container

Plain-simple array container implementation for PSR-11

2.0.0 2021-03-31 11:34 UTC

This package is auto-updated.

Last update: 2021-04-30 09:00:39 UTC


README

Technically\ArrayContainer is a plain-simple PSR-11 container implementation powered by a simple associative array under the hood.

Tests Status

Features

  • PSR-11
  • PHP 7.1+
  • PHP 8.0
  • Semver
  • Tests

Installation

Use Composer package manager to add ArrayContainer to your project:

composer require technically/array-container

Example

<?php

use Technically\ArrayContainer\ArrayContainer;

// ... instantiate your services: $logger, $cache, $config

// Instantiate with predefined entries
$container = new ArrayContainer([
    'logger' => $logger,
    'cache'  => $cache,
]);

// Add more entries later
$container->set('config', $config);

// Get entries from it later in your code
$logger = $container->get('logger');

Changelog

All notable changes to this project will be documented in the CHANGELOG file.

Credits