
Instal paket ini dengan komposer:
| Versi PHP | Versi paket |
|---|---|
| Php ^7.1 | composer require kafkiansky/service-locator-interrupter "1.0.4" --dev |
| PHP ^8.0 | composer require kafkiansky/service-locator-interrupter "2.0.1" --dev |
| PHP <= 8.1 | composer require kafkiansky/service-locator-interrupter "2.1.0" --dev |
| Php ^8.1 && laravel ^10.x | composer require kafkiansky/service-locator-interrupter "^4.0" --dev |
| Php ^8.2 && laravel ^11.x | composer require kafkiansky/service-locator-interrupter "^5.0" --dev |
Pengembang seperti Laravel lebih suka menggunakan beberapa jenis praktik buruk IOC. Dalam Contoh: Fasad, Metode Pembantu, Injeksi Kontainer dan Pembuatan Container Instance Anywhere: Pengontrol, Layanan, Rute, dan bahkan dalam Model. Anda perlu menyuntikkan layanan yang diperlukan dalam metode dan konstruktor, bukan memanggil wadah untuk melakukannya untuk Anda. Layanan apa pun harus memiliki kontrak sendiri, injeksi kontainer - ini bukan kontrak hukum, itu hack.
Plugin ini dapat menemukan masalah Penggunaan Locator Layanan - Pembantu, Fasad, Injeksi Kontainer, Pembuatan Container Instances - dan mencegahnya.
Bahkan jika Anda memiliki fasad sendiri, plugin akan ditemukan .
Bahkan jika Anda memiliki kelas Container/Application warisan, plugin akan ditemukan .
Bahkan jika Anda telah menerapkan FO ContainerInterface , plugin juga mencegahnya .
| Pembantu/fasad | Apa yang perlu Anda gunakan sebagai gantinya |
|---|---|
event , IlluminateSupportFacadesEvent | IlluminateEventsDispatcher::class , IlluminateContractsEventsDispatcher::class |
info , IlluminateSupportFacadesLog | IlluminateLogLogManager::class , PsrLogLoggerInterface::class |
logger , IlluminateSupportFacadesLog | IlluminateLogLogManager::class , PsrLogLoggerInterface::class |
logs , IlluminateSupportFacadesLog | IlluminateLogLogManager::class , PsrLogLoggerInterface::class |
abort, abort_if, abort_unless | IlluminateHttpExceptionsHttpResponseException , SymfonyComponentHttpKernelExceptionHttpException |
auth , IlluminateSupportFacadesAuth | IlluminateAuthAuthManager::class , IlluminateContractsAuthFactory::class |
back | IlluminateRoutingRedirector |
broadcast , IlluminateSupportFacadesBroadcast | IlluminateBroadcastingBroadcastManager , IlluminateContractsBroadcastingFactory |
cache , IlluminateSupportFacadesCache | IlluminateCacheCacheManager::class , IlluminateContractsCacheFactory::class |
config , IlluminateSupportFacadesConfig | IlluminateConfigRepository::class , IlluminateContractsConfigRepository::class |
cookie , IlluminateSupportFacadesCookie | IlluminateCookieCookieJar::class , IlluminateContractsCookieFactory::class , IlluminateContractsCookieQueueingFactory::class |
dispatch, dispatch_now | IlluminateContractsBusDispatcher , IlluminateBusDispatcher , IlluminateContractsBusQueueingDispatcher , |
redirect , IlluminateSupportFacadesRedirect | IlluminateRoutingRedirector , IlluminateHttpRedirectResponse |
report | IlluminateContractsDebugExceptionHandler |
request , IlluminateSupportFacadesRequest | IlluminateHttpRequest::class , SymfonyComponentHttpFoundationRequest::class |
response , IlluminateSupportFacadesResponse | IlluminateContractsRoutingResponseFactory , IlluminateRoutingResponseFactory , |
route , IlluminateSupportFacadesRoute | IlluminateRoutingUrlGenerator::class , IlluminateContractsRoutingUrlGenerator::class , |
url , IlluminateSupportFacadesURL | IlluminateRoutingUrlGenerator::class , IlluminateContractsRoutingUrlGenerator::class , |
session , IlluminateSupportFacadesSession | IlluminateSessionSessionManager::class , IlluminateSessionStore::class , IlluminateContractsSessionSession::class |
trans, trans_choice | IlluminateContractsTranslationTranslator , IlluminateTranslationTranslator , |
validator , IlluminateSupportFacadesValidator | IlluminateValidationFactory::class , IlluminateContractsValidationFactory::class |
view , IlluminateSupportFacadesView | IlluminateViewFactory::class , IlluminateContractsViewFactory::class |
$ composer codeceptionLisensi MIT (MIT). Lihat file lisensi untuk informasi lebih lanjut.