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

Sylius Quick Start Bundle Laravel Package

edgji/sylius-quick-start-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Steps to First Use

  1. Installation Add the bundle to your composer.json:

    composer require edgji/sylius-quick-start-bundle
    

    Enable the bundle in config/bundles.php:

    return [
        // ...
        Edgji\SyliusQuickStartBundle\EdgjiSyliusQuickStartBundle::class => ['all' => true],
    ];
    
  2. Configuration Publish the default configuration:

    php bin/console edgji:sylius-quick-start:install
    

    This runs migrations, loads fixtures, and sets up a basic Sylius sandbox.

  3. First Use Case Access the admin panel at /admin (default credentials: admin@example.com / admin). The bundle preconfigures:

    • A product catalog (e.g., "Test Product").
    • A shipping method (e.g., "Standard").
    • A payment method (e.g., "Credit Card").
    • A basic tax configuration.

Implementation Patterns

Workflows

  1. Sandbox Setup Use the bundle to bootstrap a Sylius instance for:

    • Local development.
    • Testing custom plugins.
    • Demonstrating features to clients. Example workflow:
    # Clone a Sylius repo, install dependencies, then:
    composer require edgji/sylius-quick-start-bundle
    php bin/console edgji:sylius-quick-start:install --env=dev
    
  2. Custom Fixtures Override default fixtures by extending the bundle’s configuration:

    # config/packages/edgji_sylius_quick_start.yaml
    edgji_sylius_quick_start:
        fixtures:
            products: ['%kernel.project_dir%/config/fixtures/products.yml']
            customers: ['%kernel.project_dir%/config/fixtures/customers.yml']
    
  3. Integration with Custom Plugins Use the sandbox to test plugins before deploying to production:

    # Install a plugin (e.g., SyliusLabsMoneyPlugin)
    composer require syliuslabs/money-plugin
    # Enable and configure it in the sandbox
    php bin/console edgji:sylius-quick-start:install --plugin=Sylius\MoneyPlugin\SyliusMoneyPlugin
    

Tips for Daily Use

  • Reset the Sandbox: Clear data and reinstall fixtures:
    php bin/console doctrine:database:drop --force --env=dev
    php bin/console doctrine:database:create --env=dev
    php bin/console edgji:sylius-quick-start:install --env=dev
    
  • Debugging: Use --debug flag for verbose output:
    php bin/console edgji:sylius-quick-start:install --debug
    
  • Environment-Specific Configs: Override settings per environment (e.g., dev vs. test):
    # config/packages/dev/edgji_sylius_quick_start.yaml
    edgji_sylius_quick_start:
        admin_email: dev@example.com
        admin_password: devpass
    

Gotchas and Tips

Pitfalls

  1. Database Conflicts

    • Running the installer on an existing Sylius database may cause errors. Always drop the database first:
      php bin/console doctrine:database:drop --force --env=dev
      
    • The bundle assumes a clean Sylius installation. Avoid mixing with other Sylius bundles that modify the schema (e.g., SyliusCoreBundle) without coordination.
  2. Fixture Overrides

    • Custom fixtures must follow Sylius’ fixture format (e.g., sylius_fixtures:load). Incorrect YAML structure will break the install:
      # Invalid: Missing top-level keys like "Sylius\Bundle\CoreBundle\Fixture\ProductFixture"
      products:
          - name: "Broken Product"
      
    • Use dump-fixtures to inspect default fixtures:
      php bin/console sylius:fixtures:dump
      
  3. Plugin Compatibility

    • Some Sylius plugins (e.g., those requiring custom migrations) may conflict with the bundle’s automated setup. Test plugins in isolation:
      php bin/console edgji:sylius-quick-start:install --plugin=MyPlugin --no-fixtures
      

Debugging

  • Log Output: Enable debug mode in config/packages/dev/monolog.yaml to capture bundle logs:
    handlers:
        main:
            type: stream
            path: "%kernel.logs_dir%/%kernel.environment%.log"
            level: debug
    
  • Command Help: Check available options:
    php bin/console edgji:sylius-quick-start:install --help
    
    Example output:
    Usage:
      edgji:sylius-quick-start:install [options]
    
    Options:
      --env=ENV          The Environment name
      --plugin=PLUGIN    Install with a specific plugin enabled
      --no-fixtures      Skip loading default fixtures
      --debug            Enable verbose output
    

Extension Points

  1. Custom Installer Logic Extend the bundle’s installer by creating a custom command:

    // src/Command/CustomSyliusInstaller.php
    namespace App\Command;
    
    use Edgji\SyliusQuickStartBundle\Command\InstallCommand;
    use Symfony\Component\Console\Input\InputInterface;
    use Symfony\Component\Console\Output\OutputInterface;
    
    class CustomSyliusInstaller extends InstallCommand
    {
        protected function configure(): void
        {
            $this->setName('app:sylius:install-custom');
        }
    
        protected function execute(InputInterface $input, OutputInterface $output): int
        {
            // Call parent logic
            $result = parent::execute($input, $output);
    
            // Add custom steps
            $this->addCustomProduct($output);
    
            return $result;
        }
    
        private function addCustomProduct(OutputInterface $output): void
        {
            $output->writeln('Adding custom product...');
            // Use Sylius API to create a product
        }
    }
    
  2. Configuration Dumping Dump the current configuration to debug issues:

    php bin/console debug:config edgji_sylius_quick_start
    
  3. Event Subscribers Hook into the bundle’s lifecycle via events (e.g., sylius_quick_start.install.start):

    // src/EventListener/SyliusInstallListener.php
    namespace App\EventListener;
    
    use Edgji\SyliusQuickStartBundle\Event\InstallEvent;
    use Symfony\Component\EventDispatcher\EventSubscriberInterface;
    
    class SyliusInstallListener implements EventSubscriberInterface
    {
        public static function getSubscribedEvents(): array
        {
            return [
                InstallEvent::START => 'onInstallStart',
            ];
        }
    
        public function onInstallStart(InstallEvent $event): void
        {
            $event->getOutput()->writeln('Custom logic on install start!');
        }
    }
    
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.
nasirkhan/laravel-sharekit
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