abmmhasan / oof
A Collection of useful PHP class functions.
Requires
- php: >=8.2
- psr/container: ^2.0
- symfony/cache: ^7.2
Requires (Dev)
- captainhook/captainhook: ^5.24
- laravel/pint: ^1.20
- pestphp/pest: ^3.7
- rector/rector: ^2.0
- symfony/var-dumper: ^7.2
This package is auto-updated.
Last update: 2025-03-14 03:25:47 UTC
README
InterMix
is a lightweight & versatile PHP library designed to provide commonly needed class-oriented tools with simplicity and efficiency. Whether you are managing dependencies or enhancing classes with macros, InterMix has you covered.
Key Features
- Dependency Injector (Container): Fully PSR-11 compliant for seamless integration.
- Class Initialization Barrier (Fence): Ensures safe and controlled initialization of classes.
- Class Macro (MacroMix): Extend classes dynamically with powerful macros.
- Memoization: Improve performance by caching function results.
Prerequisites
- PHP 8.2 or higher
Library Version | PHP Version |
---|---|
2.x.x | 8.2.x or Higher |
1.x.x | 8.x.x |
Installation
Install InterMix using Composer:
composer require infocyph/intermix
Getting Started
Here's how you can quickly get started with InterMix:
Dependency Injection Example
use Infocyph\InterMix\Container; $container = new Container(); // Resolve and use the service $exampleService = $container->get('example_service'); $exampleService->performAction();
Using Class Macros
$mixin = new class { public function greet($name) { return "Hello, $name!"; } protected function whisper($message) { return "psst... $message"; } }; MacroTestClass::mix($mixin); $object = new MacroTestClass; echo $object->greet('World'); // Hello, World! echo $object->whisper('John'); // psst... John
Documentation
Comprehensive documentation is available on Read the Docs. It covers everything from installation to advanced use cases.
Testing
To ensure the library is functioning as expected, you can run the test suite. Make sure you have the necessary dependencies installed:
composer install
composer test
Contributing
We welcome contributions! If you encounter bugs, have feature requests, or want to help improve the library, please create an issue.
Support
Need help? Open an issue or reach out through the GitHub repository. We're here to help!
License
InterMix is licensed under the MIT License. Feel free to use and modify it as needed.