PHPackages                             bardiz12/auto-inject-for-laravel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. bardiz12/auto-inject-for-laravel

ActiveLibrary[PSR &amp; Standards](/categories/psr-standards)

bardiz12/auto-inject-for-laravel
================================

Automatic dependency injection for laravel

v1.0.1(1y ago)0158↓100%MITPHPCI passing

Since May 8Pushed 1y ago1 watchersCompare

[ Source](https://github.com/bardiz12/auto-inject-for-laravel)[ Packagist](https://packagist.org/packages/bardiz12/auto-inject-for-laravel)[ RSS](/packages/bardiz12-auto-inject-for-laravel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (4)Versions (3)Used By (0)

Auto Inject For Laravel
=======================

[](#auto-inject-for-laravel)

[![codecov](https://camo.githubusercontent.com/987993c9f8a02725954e4e1b3122d31d02c9d1efffcae48884959259c6b94f6f/68747470733a2f2f636f6465636f762e696f2f6769746875622f62617264697a31322f6175746f2d696e6a6563742d666f722d6c61726176656c2f67726170682f62616467652e7376673f746f6b656e3d5a585256395144524541)](https://codecov.io/github/bardiz12/auto-inject-for-laravel)

Inspired by php-di's `#[Inject()]` attribute, i created a simple package to automatically inject dependency to php class's properties. This package is also support lazy load the dependency by proxying the access to class via Laravel's app() helper.

Installation
------------

[](#installation)

`composer require bardiz12/auto-inject-for-laravel`

Usage
-----

[](#usage)

1. Use Auto Inject trait and add autoInject method in your constructor

    ```
