kba-team / memory-container
PSR-11 container storing its values in memory and offering a singleton access.
v3.0.0
2026-09-02 11:29 UTC
Requires
- php: ^8.1
- psr/container: ^2.0
Requires (Dev)
- phpunit/phpunit: ^9.6.33
- squizlabs/php_codesniffer: ^4.0
Suggests
None
Provides
Conflicts
None
Replaces
None
README
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