Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Symfony Aware Laravel Package

adtechpotok/symfony-aware

Symfony “aware” interfaces and traits for quickly injecting common services (EntityManager, Doctrine, cache, logger, kernel, request stack, etc.) into your classes. Works with explicit service calls or Symfony 3.3+ autowiring.

View on GitHub
Deep Wiki
Context7

Build Status License

Aware

Пример использования

Сервис
<?php

use Adtechpotok\Aware\Interfaces\EntityManagerAwareInterface;
use Adtechpotok\Aware\Traits\EntityManagerAwareTrait;

class SomeClass implements EntityManagerAwareInterface
{
    use EntityManagerAwareTrait;
    
    public function someMethod()
    {
        dump($this->em); // $em - дефолтный EntityManager, аналог '@doctrine.orm.default_entity_manager'
    }
}
Объявление сервиса
services:
    some.service:
        class: SomeClass
        calls:
            - {method: setEntityManager, arguments: ['@doctrine.orm.default_entity_manager']}
Таблица соответствий
Aware Service
ConnectionAware @doctrine.dbal.default_connection
CacheAware @cache.app
ContainerAware @service_container
DoctrineAware @doctrine
EntityManagerAware @doctrine.orm.default_entity_manager
EventDispatcherAware @debug.event_dispatcher
FilesystemAware @filesystem
FileLocatorAware @file_locator
FileLinkFormatterAware @debug.file_link_formatter
HttpKernelAware @http_kernel
KernelAware @kernel
LoggerAware @monolog.logger
PropertyAccessorAware @property_accessor
ReaderAware @annotations.cached_reader
RequestStackAware @request_stack
StopwatchAware @debug.stopwatch
Объявление сервиса в Symfony >= 3.3
services:
    _defaults:
        autowire: true
        
    some.service:
        class: SomeClass

Важно! При объявлении сервисов, которые требуют использования тэгов - этот способ не подоходит, Symfony игнорирует тэги при autowire.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
andydefer/laravel-notification
adachsoft/cli-process-tester
jhaskell13/laraflow
sebastienheyd/boilerplate-media-manager
ccast/tagixo-primix
pretendtrue/laravel-builder
sawmainek/laravel-scout-tntsearch-driver
tomshaw/laravel-calendar-table
dibakar/laravel-ownership
steadrun/laravel-monitor
labyrinthe/connect-laravel
elmogy/layan
drewdan/sentinel-client
dskripchenko/laravel-llm
fatryst/nuonuo
stevenay/myanfont
gmostafa/php-graphql-client
xeviant/paystack
snowsoft/faker
meditationsteps/blogetc