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

Minishop Bundle Laravel Package

birko/minishop-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation

    composer require birko/minishop-bundle
    

    Add to config/bundles.php:

    Birko\MiniShopBundle\BirkoMiniShopBundle::class => ['all' => true],
    
  2. First Use Case

    • Run migrations:
      php bin/console doctrine:migrations:diff
      php bin/console doctrine:migrations:migrate
      
    • Access the admin panel (default route: /admin) to configure products, categories, and orders.
  3. Key Configuration Check config/packages/birko_minishop.yaml for:

    • Currency settings
    • Tax rules
    • Payment gateway configurations

Implementation Patterns

Core Workflows

  1. Product Management

    • Use Product entity (src/Entity/Product) for CRUD operations.
    • Example: Create a product via form:
      $product = new Product();
      $product->setName('Laptop');
      $product->setPrice(999.99);
      $product->setCategory($categoryEntity);
      $em->persist($product);
      $em->flush();
      
  2. Order Processing

    • Extend Order entity (src/Entity/Order) for custom logic.
    • Use OrderService for workflows:
      $order = $orderService->createOrder($cartId, $user);
      $orderService->processPayment($order);
      
  3. Frontend Integration

    • Use Twig extensions (src/Twig/) for dynamic content:
      {{ minishop_cart_total() }}
      
    • Hook into events (src/Event/):
      $dispatcher->addListener(OrderEvents::ORDER_CREATED, function (OrderEvent $event) {
          // Custom logic on order creation
      });
      
  4. API Endpoints

    • Leverage FOSRestBundle integration (if enabled) for:
      # config/routes.yaml
      minishop_api:
          resource: "@BirkoMiniShopBundle/Resources/config/routing/api.yaml"
          prefix: /api
      

Common Patterns

  • Dependency Injection: Inject MiniShopManager for core functionality:
    public function __construct(private MiniShopManager $miniShop) {}
    
  • Event-Driven: Extend events like ProductUpdatedEvent or OrderStatusChangedEvent.
  • Configuration Overrides: Override default settings via YAML:
    birko_minishop:
        currency: 'USD'
        tax_rate: 0.08
    

Gotchas and Tips

Pitfalls

  1. Doctrine Migrations

    • Run migrations after installation to avoid ColumnNotFoundException.
    • Custom fields may require schema updates:
      php bin/console doctrine:schema:update --force
      
  2. Caching Issues

    • Clear cache after config changes:
      php bin/console cache:clear
      
    • Use MiniShopCache service for manual cache invalidation:
      $this->miniShop->getCache()->invalidate('product_list');
      
  3. Payment Gateways

    • Default gateways (e.g., Stripe) require API keys in config/packages/birko_minishop.yaml.
    • Test in sandbox mode first:
      payment_gateways:
          stripe:
              test_mode: true
      
  4. Admin Panel Permissions

    • Roles are managed via Symfony’s security system. Ensure users have ROLE_MINISHOP_ADMIN:
      # config/packages/security.yaml
      role_hierarchy:
          ROLE_ADMIN: ROLE_MINISHOP_ADMIN
      

Debugging Tips

  • Enable Debug Mode: Set APP_DEBUG=true in .env for detailed logs.
  • Event Listeners: Check var/log/dev.log for event dispatching issues.
  • Database Dumps: Use:
    php bin/console doctrine:query:sql "SELECT * FROM product"
    

Extension Points

  1. Custom Fields

    • Extend Product entity with traits or use Doctrine extensions:
      use Gedmo\Mapping\Annotation as Gedmo;
      /**
       * @Gedmo\Slug(fields={"name"})
       */
      private $slug;
      
  2. Payment Methods

    • Implement PaymentGatewayInterface for new gateways:
      class PayPalGateway implements PaymentGatewayInterface {
          public function processPayment(Order $order, array $data): bool { ... }
      }
      
  3. Theming

    • Override Twig templates in templates/birko_minishop/:
      {# templates/birko_minishop/product/show.html.twig #}
      {% extends 'birko_minishop/base.html.twig' %}
      
  4. API Extensions

    • Add custom API routes in src/Resources/config/routing/api.yaml:
      minishop_custom_api:
          path: /api/custom
          methods: GET
          defaults: { _controller: 'App\Controller\CustomApiController::index' }
      
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.
babenkoivan/elastic-client
innmind/static-analysis
innmind/coding-standard
datacore/hub-sdk
alengo/sulu-http-cache-bundle
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
imbo/imbo-coding-standard
visualbuilder/filament-lottie
servicioslineaonce/starter-kit
atomcoder/laravel-reorderable
irajul/filament-shadcn-theme
agtp/agtp-php
agtp/mod-php
centraldesktop/protobuf-php