kafkiansky/service-locator-interrupter
| Install | |
|---|---|
composer require kafkiansky/service-locator-interrupter |
|
| Latest Version: | 5.0.0 |
| PHP: | ^8.2 |
| License: | MIT |
| Last Updated: | Jun 24, 2024 |
| Links: | GitHub · Packagist |
Psalm plugin that prevent service locator calls for Laravel applications.
Contents:
Installation
Install this package with Composer:
WHY
Laravel-like developers prefer to use some kinds of ioc bad practices. In example: facades, helpers method, container injection and container instances creation anywhere: controllers, services, routes and even in models. You need inject necessary services in method and constructor, not call container to do it for you. Any services must has it own contract, container injection - it's not legal contract, it's hack.
This plugin can found issues of service locator usage - helpers, facades, container injection, container instances creation - and prevent them.
Even if you have your own facade, the plugin will be found it.
Even if you have inherited Container/Application classes, the plugin will be found it.
Even if you have implemented any fo ContainerInterface, the plugin also prevent that.
Dependency Injection
Replacement map
Testing
$ composer codeception
License
The MIT License (MIT). See License File for more information.
Related Packages
Laravel Auth Checker allows you to log users authentication, devices authenticat...
Laravel Impersonate is a plugin that allows to you to authenticate as your users...
Laravel Impersonate is a plugin that allows to you to authenticate as your users...