spiral / prototype
Automatic dependency injection
v2.7.4
2020-12-24 10:52 UTC
Requires
- php: >=7.2
- ext-json: *
- doctrine/inflector: ^1.4|^2.0
- nikic/php-parser: ^4.1
- spiral/annotations: ^2.8
- spiral/console: ^2.8
Requires (Dev)
- cycle/orm: ^1.2.6
- mockery/mockery: ^1.3
- phpunit/phpunit: ^8.5|^9.0
- spiral/debug: ^2.8
This package is auto-updated.
Last update: 2021-01-12 12:17:51 UTC
README
This spiral framework extension enables IDE friendly helpers and let's you to convert this ...
namespace App\Controller; use Spiral\Prototype\Traits\PrototypeTrait; class HomeController { use PrototypeTrait; public function index() { $select = $this->users->select(); } }
... into that via php app.php proto:inject -r
console command:
namespace App\Controller; use App\UserRepository; class HomeController { /** @var UserRepository */ private $users; /** * @param UserRepository $users */ public function __construct(UserRepository $users) { $this->users = $users; } public function index() { $select = $this->users->select(); } }
Plugin includes collision prevention mechanism and able to modify existed constructors.
License:
MIT License (MIT). Please see LICENSE
for more information. Maintained by Spiral Scout.