Installation
Add the bundle to your composer.json:
composer require bleuebuzz/shop-bundle
Enable it in config/bundles.php:
return [
// ...
Bleuebuzz\ShopBundle\BleuebuzzShopBundle::class => ['all' => true],
];
Database Configuration
Run migrations (check src/Resources/migrations for schema):
php bin/console doctrine:migrations:migrate
Verify config/packages/bleuebuzz_shop.yaml for connection settings.
First Use Case: Product CRUD
Use the provided controllers (ProductController) or create a custom one:
use Bleuebuzz\ShopBundle\Entity\Product;
use Bleuebuzz\ShopBundle\Form\ProductType;
// In your controller:
$product = new Product();
$form = $this->createForm(ProductType::class, $product);
Product Management
ProductRepository with DQL:
$products = $this->getDoctrine()
->getRepository(Product::class)
->findBy(['active' => true]);
BleuebuzzShopBundle:Product:search route with query params (?q=term).Cart Integration
Bleuebuzz\ShopBundle\Service\CartManager:
$cart = $this->get('bleuebuzz_shop.cart_manager');
$cart->add($product, 2); // Add 2 units
Checkout
BleuebuzzShopBundle:Order:checkout with a form handler:
$order = $cart->checkout($user, $shippingAddress);
$this->get('bleuebuzz_shop.order_processor')->process($order);
{{ app.bleuebuzz_shop.cart.total|price }}
bleuebuzz.shop.order.created for post-purchase logic:
# config/services.yaml
services:
App\EventListener\OrderListener:
tags:
- { name: kernel.event_listener, event: bleuebuzz.shop.order.created, method: onOrderCreated }
Session Cart Dependency
Bleuebuzz\ShopBundle\Service\PersistentCart with Redis:
# config/packages/bleuebuzz_shop.yaml
cart:
persistent: true
redis_dsn: 'redis://localhost'
Translation Quirks
name, description) must be translatable. Use gedmo/translatable:
composer require gedmo/doctrine-extensions
Enable in config/packages/doctrine.yaml:
gedmo_translatable:
default_lifecycle: true
Order Status Transitions
Bleuebuzz\ShopBundle\Model\OrderStateMachine:
$stateMachine->addTransition('cancel', 'pending', 'cancelled');
php bin/console cache:clear
ProductType constraints in src/Form/ProductType.php for hidden rules.Custom Fields
Extend Product entity with traits:
use Bleuebuzz\ShopBundle\Entity\Traits\CustomProductFields;
class ExtendedProduct extends Product {
use CustomProductFields;
}
Payment Gateways
Implement Bleuebuzz\ShopBundle\Payment\GatewayInterface:
class StripeGateway implements GatewayInterface {
public function pay(Order $order, array $options) { ... }
}
Register in services.yaml:
services:
App\Payment\StripeGateway:
tags: [bleuebuzz_shop.payment_gateway]
How can I help you explore Laravel packages today?