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

Core Bundle Laravel Package

dylvn/core-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation Add the bundle to your Laravel/OroCommerce project via Composer:

    composer require dylvn/core-bundle
    

    Register the bundle in config/bundles.php:

    return [
        // ...
        Dylvn\CoreBundle\DylvnCoreBundle::class => ['all' => true],
    ];
    
  2. First Use Case The bundle provides foundational utilities for OroCommerce integrations. Start by leveraging its event system or service container extensions:

    use Dylvn\CoreBundle\Event\DylvnEvent;
    use Symfony\Component\EventDispatcher\EventDispatcherInterface;
    
    // Dispatch a custom event
    $dispatcher->dispatch(new DylvnEvent('custom.event.name'));
    
  3. Key Entry Points

    • Configuration: Check config/packages/dylvn_core.yaml for default settings.
    • Services: Review src/DependencyInjection/DylvnCoreExtension.php for available services.
    • Events: Explore src/Event/ for extensible event classes.

Implementation Patterns

Core Workflows

  1. Event-Driven Extensions Extend OroCommerce workflows by subscribing to Dylvn events:

    // In a service or controller
    $dispatcher->addListener(DylvnEvent::PRE_PROCESS, function (DylvnEvent $event) {
        if ($event->getName() === 'order.pre_save') {
            $event->setData(['custom_field' => 'value']);
        }
    });
    
  2. Service Integration Use the bundle’s services (e.g., dylvn.core.logger) for cross-cutting concerns:

    $logger = $container->get('dylvn.core.logger');
    $logger->info('Custom OroCommerce integration', ['context' => 'order']);
    
  3. Configuration Overrides Override default settings in config/packages/dylvn_core.yaml:

    dylvn_core:
        api:
            enabled: true
            timeout: 30
    

Common Use Cases

  • API Integration: Use the bundle’s HTTP client utilities to interact with Dylvn APIs.
  • Data Transformation: Leverage serializers/deserializers for OroCommerce ↔ Dylvn data mapping.
  • Validation: Extend Oro’s validation system with Dylvn-specific rules.

Gotchas and Tips

Pitfalls

  1. OroCommerce Dependency

    • The bundle assumes OroCommerce is installed. Ensure compatibility with your Oro version (e.g., oro/platform).
    • Fix: Check composer.json for Oro version constraints.
  2. Event Naming Collisions

    • Custom events may conflict with Oro’s native events.
    • Tip: Prefix event names (e.g., dylvn.order.pre_save).
  3. Service Container Conflicts

    • Overriding services may break Oro’s DI.
    • Tip: Use replace tags in services.yaml sparingly; prefer composition.

Debugging

  • Event Debugging: Enable Symfony’s event dispatcher debug mode:
    $dispatcher->addListener(DylvnEvent::class, function ($event) {
        if (app()->environment('dev')) {
            error_log('Event: ' . get_class($event));
        }
    });
    
  • Configuration Validation: Use php bin/console debug:config dylvn_core to inspect loaded settings.

Extension Points

  1. Custom Events Extend DylvnEvent to create domain-specific events:

    class CustomOrderEvent extends DylvnEvent {
        public function __construct(string $orderId, array $metadata) {
            parent::__construct('custom.order.event');
            $this->orderId = $orderId;
            $this->metadata = $metadata;
        }
    }
    
  2. Service Decorators Decorate bundle services to modify behavior:

    # config/services.yaml
    services:
        dylvn.core.logger:
            decorates: dylvn.core.logger
            arguments: ['@dylvn.core.logger.inner']
    
  3. Twig Extensions Add Dylvn-specific Twig filters/functions:

    // src/Twig/DylvnExtension.php
    class DylvnExtension extends \Twig\Extension\AbstractExtension {
        public function getFilters() {
            return [
                new \Twig\TwigFilter('dylvn_format_currency', [$this, 'formatCurrency']),
            ];
        }
    }
    
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.
craftcms/url-validator
directorytree/privacy-filter-classifier
directorytree/privacy-filter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit
testo/output-teamcity
testo/bridge-symfony