Bitrix Service Locator

Covers DI container Bitrix\Main\DI\ServiceLocator (PSR-11) — registration of services in the services section of a module's .settings.php file, autowire, retrieving dependencies via has()/get(), constructor injection in application services, action-parameter injection in controllers, binding interfaces to implementations. Applied when moving logic to services, avoiding static calls, and wiring dependencies into services and controller actions (not console/event constructors). Key terms — ServiceLocator, DI, services, autowire, PSR-11, dependency injection, container.

bxmaximum 7e9c647 8.1 KB Updated

File contents

bxmaximum/bitrix-framework-skills/tree/main/skills/bitrix-service-locator commit 7e9c647d7e

Frequently asked questions

npx skillmds@latest add bxmaximum/bitrix-service-locator