Install via Composer
composer require common-gateway/pet-store-bundle:dev-main
dev-main for the latest features (or a stable tag if available).Install Schemas
php bin/console commongateway:install common-gateway/pet-store-bundle
Admin UI Discovery
PetStoreBundle, select it, and install via the UI (no manual config needed).Verify Installation
/api/pets) or admin UI sections appear.php bin/console debug:router | grep pet to confirm route registration.PetController (located in src/Controller/).PetEvents::POST_CREATED) to hook into workflows.php bin/console debug:event-dispatcher | grep Pet
src/
├── Controller/ # Extend or replace controllers (e.g., PetController)
├── Entity/ # Define custom entities (e.g., Pet.php)
├── Event/ # Listen to/emit events (e.g., PetEvents)
├── Resources/config/ # Override services/routing (YAML/XML/PHP)
├── Migrations/ # Database schema changes (Doctrine)
PetStoreBundle.php: Define dependencies (e.g., CommonGatewayCoreBundle).Resources/config/routing.yaml: Add custom routes (e.g., pet_store.index).// src/EventListener/PetListener.php
namespace App\EventListener;
use CommonGateway\PetStoreBundle\Event\PetEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class PetListener implements EventSubscriberInterface
{
public static function getSubscribedEvents(): array
{
return [
PetEvents::POST_CREATED => 'onPetCreated',
];
}
public function onPetCreated(PetEvent $event): void
{
// Custom logic (e.g., send notification)
}
}
# config/services.yaml
services:
CommonGateway\PetStoreBundle\Service\PetManager:
arguments:
$logger: '@monolog.logger.pet_store'
# src/Resources/config/routing.yaml
pet_store_custom:
path: /api/pets/custom
controller: App\Controller\CustomPetController::index
methods: [GET]
php bin/console make:migration
php bin/console doctrine:migrations:migrate
Resources/views/ templates or using Twig overrides.Schema Conflicts:
commongateway:install twice may cause duplicate schema errors.Migrations/ for conflicts.Event Dispatcher Order:
PetStoreBundle may not trigger if the bundle isn’t loaded early.PetStoreBundle is listed before your app bundle in config/bundles.php.Route Prefix Collisions:
/api/pets) may conflict with existing routes.config/routing.yaml:
common_gateway_pet_store:
resource: "@PetStoreBundle/Resources/config/routing.yaml"
prefix: "/custom-prefix"
Dev vs. Prod Dependencies:
dev-main in production may break stability.1.0.0) in composer.json.php bin/console debug:container | grep PetStoreBundle
php bin/console debug:event-dispatcher
php bin/console commongateway:install common-gateway/pet-store-bundle --verbose
Custom Entities:
CommonGateway\PetStoreBundle\Entity\Pet or create new entities in your app.namespace App\Entity;
use CommonGateway\PetStoreBundle\Entity\Pet as BasePet;
class Pet extends BasePet
{
// Add custom fields/methods
}
Plugin Metadata:
config/packages/pet_store.yaml:
common_gateway_pet_store:
plugin:
name: "Custom Pet Store"
description: "Extended pet management"
icon: "paw"
Command-Line Tools:
src/Command/ to interact with the bundle’s data:
php bin/console make:command ListPets
How can I help you explore Laravel packages today?