InterMix

Security & Standards Documentation Status Packagist Downloads License: MIT Packagist Version Packagist PHP Version GitHub Code Size

InterMix is a modern, lightweight PHP toolkit for developers who love class-oriented design, clean architecture, and fast execution. From dependency injection to dynamic macros, every utility is designed to just work โ€” with minimal config and maximum control.


๐Ÿš€ Key Features


๐Ÿ“ฆ Installation

composer require infocyph/intermix

Supported PHP versions:

InterMix Version PHP Version
2.x.x and above 8.2 or newer
1.x.x 8.0โ€“8.1 compatible

โšก Quick Examples

๐Ÿงฑ Dependency Injection

use function Infocyph\InterMix\container;

$c = container();
$c->definitions()->bind('now', fn () => new DateTimeImmutable());

echo $c->get('now')->format('c');

Enable autowiring with attributes:

$c->options()->setOptions(
    injection: true,
    methodAttributes: true,
    propertyAttributes: true
);

Tag-based resolution:

$c->definitions()->bind('a', A::class, tags: ['service']);
$c->definitions()->bind('b', B::class, tags: ['service']);

foreach ($c->findByTag('service') as $svc) {
    $svc()->handle();
}

See full container guide at: ๐Ÿ“– https://intermix.readthedocs.io/en/latest/di/overview.html


๐Ÿงฌ Dynamic Macros

MacroTest::mix(new class {
    public function hello($name) {
        return "Hey, $name!";
    }
});

echo (new MacroTest)->hello('Ali'); // Hey, Ali!

๐Ÿง  once() Memoization

use function Infocyph\InterMix\Remix\once;

$value = once(fn() => rand(1000, 9999)); // Only runs once per file+line

๐Ÿ“š Documentation

Full documentation available on ReadTheDocs:

๐Ÿ”— https://intermix.readthedocs.io

Includes:


โœ… Testing

composer install
composer test

๐Ÿค Contributing

Got ideas or improvements? Join us!

๐Ÿ“‚ Open issues ๐Ÿ“ฌ Submit a PR โ€” we welcome quality contributions


๐Ÿ›ก License

MIT Licensed โ€” use it freely, modify it openly.

๐Ÿ”— opensource.org/licenses/MIT