Skip to content
This repository was archived by the owner on Apr 3, 2025. It is now read-only.

laravel-tools/lazy-dependency

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Tools - Lazy Dependency

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 [email protected] 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

About

This package provides a possibility to lazy load dependencies using attribute.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages