Skip to content

infocyph/InterMix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

441 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

InterMix

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

InterMix is a modern, lightweight PHP toolkit for developers who value class-oriented design, clean architecture, and fast execution. It combines dependency injection, serialization, macro-style extensibility, and helper utilities with minimal config and maximum control.


πŸš€ Key Features

  • Dependency Injection (DI) β€” PSR-11 compliant container with:
    • attribute-based injection
    • scoped lifetimes
    • lazy loading
    • environment-specific overrides
    • debug tracing & definition-cache integration via assignable PSR-6 pool
  • Serializer β€” Closure-aware value serialization and resource handlers
  • Fence β€” Enforce singleton-style class safety
  • Remix β€” Fluent traits, proxies, and global helper functions
  • MacroMix β€” Dynamically extend objects or classes with macros
  • Global Utilities β€” Like pipe(), retry(), measure() and more

πŸ“¦ Installation

composer require infocyph/intermix

Supported PHP versions:

InterMix Version PHP Version
2.x.x and above 8.3 or newer
1.x.x 8.0-8.2 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://docs.infocyph.com/projects/intermix/di/overview.html


🧬 Dynamic Macros

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

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

🧠 Definition Cache (Injectable)

use Psr\Cache\CacheItemPoolInterface;

$pool = /* any PSR-6 pool, e.g. from infocyph/cachelayer */;
$c->definitions()->enableDefinitionCache($pool);

πŸ“š Documentation

Full documentation available at:

πŸ”— https://docs.infocyph.com/projects/intermix/

Includes:

  • βœ… Getting Started & Quickstart
  • πŸ“¦ DI Container Guide (bindings, scopes, attributes, lifetimes)
  • 🧩 Modules: DI, Serializer, Remix, Fence, MacroMix
  • πŸ§ͺ Testing & Caching Tips
  • πŸ“˜ PDF/ePub formats

βœ… 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

About

A modern, lightweight PHP toolkit for developers who value class-oriented design, clean architecture and fast execution. It combines dependency injection, serialization, macro-style extensibility and helper utilities with minimal config and maximum control.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Contributors

Languages