Weave Code
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

Atwork Bundle Laravel Package

atournayre/atwork-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation:

    composer require atournayre/atwork-bundle
    

    Register the bundle in config/bundles.php:

    return [
        // ...
        \Atournayre\Bundle\AtWorkBundle\AtworkBundle::class => ['all' => true],
    ];
    
  2. First Use Case: The bundle is described as an "overlay" to Symfony, implying it extends or modifies core behavior. Start by inspecting the bundle's Resources/config/services.yaml (if provided) or its DependencyInjection extension to identify hooks or services it exposes. Example:

    # config/packages/atwork.yaml (if auto-configured)
    atwork:
        enabled: true
        # ... (check for default config keys)
    
  3. Debugging Entry Point: Use Symfony’s debug:container command to list the bundle’s services:

    php bin/console debug:container | grep atwork
    

    Look for event listeners, compilers, or custom services (e.g., atwork.*).


Implementation Patterns

Core Workflows

  1. Event Listeners/Subscribers: The bundle likely hooks into Symfony’s kernel or framework events (e.g., kernel.request, controller). Example:

    // src/EventListener/AtWorkListener.php
    namespace App\EventListener;
    
    use Atournayre\Bundle\AtWorkBundle\Event\AtWorkEvent;
    use Symfony\Component\EventDispatcher\Attribute\AsEventListener;
    
    class AtWorkListener {
        #[AsEventListener(event: AtWorkEvent::class, method: 'onAtWorkEvent')]
        public function onAtWorkEvent(AtWorkEvent $event) {
            // Custom logic (e.g., modify request/response).
        }
    }
    
  2. Configuration Overrides: Extend the bundle’s configuration via config/packages/atwork.yaml:

    atwork:
        custom_option: true
        # Override defaults or add new keys.
    
  3. Twig Integration (if applicable): Check for Twig extensions or filters (e.g., atwork_*). Example usage:

    {{ atwork_filter(some_variable) }}
    
  4. Command Integration: If the bundle adds CLI commands, use them directly:

    php bin/console atwork:command --help
    

Integration Tips

  • Dependency Injection: Prefer injecting the bundle’s services (e.g., AtworkService) over static calls.
  • Testing: Mock the bundle’s services in PHPUnit:
    $this->container->set('atwork.service', $mockService);
    
  • Symfony Flex: If the bundle uses Flex recipes, check config/bundles.php for auto-configuration.

Gotchas and Tips

Pitfalls

  1. Undocumented Features:

    • The bundle’s README lacks specifics. Use php bin/console debug:container to discover services.
    • Workaround: Check the src/DependencyInjection folder for extension logic or compiler passes.
  2. PHP/Symfony Version Lock:

    • Hard dependency on Symfony 6.2.* and PHP 8.2+. Avoid downgrading unless necessary.
  3. No Events/Listeners Exposed:

    • If the bundle doesn’t document events, inspect its EventDispatcher usage via:
      php bin/console debug:event-dispatcher
      
  4. Configuration Conflicts:

    • Overriding config keys may break functionality. Test incrementally.

Debugging

  • Service Not Found: Ensure the bundle is enabled in bundles.php and dependencies are installed.

    composer why-not atournayre/atwork-bundle
    
  • Runtime Errors: Enable Symfony’s error handler in .env:

    APP_DEBUG=1
    

Extension Points

  1. Custom Services: Extend the bundle’s services via compiler passes:

    // src/DependencyInjection/Compiler/AtWorkPass.php
    use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
    use Symfony\Component\DependencyInjection\ContainerBuilder;
    
    class AtWorkPass implements CompilerPassInterface {
        public function process(ContainerBuilder $container) {
            $definition = $container->findDefinition('atwork.service');
            $definition->addMethodCall('setCustomOption', ['value']);
        }
    }
    
  2. Event Dispatching: If the bundle lacks events, create your own:

    // src/Event/AtWorkCustomEvent.php
    namespace App\Event;
    
    use Symfony\Contracts\EventDispatcher\Event;
    
    class AtWorkCustomEvent extends Event {
        public function __construct(public string $data) {}
    }
    
  3. Twig Extensions: Add custom filters/functions by implementing TwigExtension:

    // src/Twig/AppExtension.php
    use Twig\Extension\AbstractExtension;
    use Twig\TwigFunction;
    
    class AppExtension extends AbstractExtension {
        public function getFunctions(): array {
            return [new TwigFunction('app_atwork_filter', [$this, 'filter'])];
        }
    }
    
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.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor