kafkiansky/service-locator-interrupter

Psalm plugin for Laravel that interrupt service locator calls.
18,917 8
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
Maintainer: kafkiansky

Psalm plugin that prevent service locator calls for Laravel applications.

test Software License Quality Score StyleCI Total Downloads

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

lab404/laravel-auth-checker

Laravel Auth Checker allows you to log users authentication, devices authenticat...

168,712 222
rickycezar/laravel-jwt-impersonate

Laravel Impersonate is a plugin that allows to you to authenticate as your users...

132,666 24
lab404/laravel-impersonate

Laravel Impersonate is a plugin that allows to you to authenticate as your users...

20,619,309 2,340
lara-press/framework

The LaraPress framework.

3,900 3