laravel-tools / lazy-dependency
This package is abandoned and no longer maintained.
No replacement package was suggested.
This package provides a possibility to lazy load dependencies using attribute.
v2024.1.0
2024-03-16 15:41 UTC
Requires
- php: ^8.3
Requires (Dev)
- orchestra/testbench: ^8.21
- pestphp/pest: ^2.34
This package is not auto-updated.
Last update: 2025-04-13 19:03:01 UTC
README
This package provides a possibility to lazy load dependencies using attribute.
Installation
You can install the package via composer:
composer require laravel-tools/lazy-dependency
Security
If you discover any security related issues, please email rlempa@gmail.com instead of using the issue tracker.
Usage
Trait is required to be used. Recommended way is to create base abstract class for Controller, Services etc. and use that trait in that base class.
new class { use UseDependency; #[Dependency] readonly protected ExampleClass $service; public function hello(): string { return $this->service->hello(); } };
Development
To start developing first you must install the dependencies:
docker run --rm -v $(pwd):/app composer install
Testing
To test the package you can run:
docker run --rm -v $(pwd):/app -w /app php:8.3-cli vendor/bin/pest