Search by

kba-team / memory-container

grej

PSR-11 container storing its values in memory and offering a singleton access.

Package info

github.com/the-kbA-team/memory-container

pkg:composer/kba-team/memory-container

Statistics

Installs: 681

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v3.0.0 2026-09-02 11:29 UTC

This package is auto-updated.

Last update: 2026-09-02 11:35:25 UTC


README

License: MIT

PSR-11 container storing its values in memory and offering a singleton access.

Usage

A simple example:

<?php
namespace vendor\product;

class Greeter
{
    public function __construct(\Closure $logic) {
        printf('%s%s', $logic('world'), PHP_EOL);
    }
}
<?php

use kbATeam\MemoryContainer\Container;
use vendor\product\Greeter;

Container::singleton()->set('hello', function ($what) {
    return sprintf('Hello %s!', $what);
});
// ...
$example = new Greeter(Container::singleton()->get('hello'));

Development

All development commands (install, test, lint, beautify, sniff, audit, validate) run via Docker through the Makefile, so no local PHP installation is needed. Run make help to list all targets. Most targets require PHP_VERSION, e.g.:

make install PHP_VERSION=8.1