This guide helps AI assistants remove example customizations from a Sylius Plugin Skeleton.
First, identify all files related to the customization (e.g., "greeting", "example", "demo"):
# Search for class names, function names, and references
grep -r "greeting" . --include="*.php" --include="*.js" --include="*.yml" --include="*.yaml" --include="*.xml" --include="*.twig"
grep -r "example" . --include="*.php" --include="*.js" --include="*.yml" --include="*.yaml" --include="*.xml" --include="*.twig"Common locations for example files in Sylius plugins:
src/Controller/*ExampleController.phpsrc/Controller/*DemoController.php
assets/shop/js/*.js(example scripts)assets/admin/js/*.js(example scripts)
templates/shop/[feature_name]/(entire directories)templates/admin/[feature_name]/(entire directories)
features/*_example.featurefeatures/*_demo.featuretests/Behat/Context/*/ExampleContext.phptests/Behat/Page/*/Example*Page.php
File: config/services.xml
- Remove service definitions for example controllers
- Look for:
<service id="...Controller\ExampleController" />
Files: config/routes/shop.yaml, config/routes/admin.yaml
- Remove entire route definitions for example features
- Look for routes with "example", "demo", or feature-specific names
Files: config/twig_hooks/shop.yaml, config/twig_hooks/admin.yaml
- Remove hook definitions for example features
- Remove entire
config/twig_hooks/directory if it only contains empty placeholder files - Look for:
'app_shop.example.*'or similar patterns
Files: assets/shop/entrypoint.js, assets/admin/entrypoint.js
- Remove imports of deleted JavaScript files
- Look for:
import './js/example';
File: config/config.yaml
- Remove imports that reference deleted directories
- Look for:
- { resource: "twig_hooks/**/*.yaml" }or similar broken imports - Clean up any example-specific configuration
File: tests/Behat/Resources/suites.yml
- Remove suite definitions for example features
- Look for suites with example/demo names
Use this checklist to ensure complete cleanup:
-
Delete files:
- Controllers (
src/Controller/) - JavaScript files (
assets/*/js/) - Template directories (
templates/*/) - Feature files (
features/) - Behat test files (
tests/Behat/)
- Controllers (
-
Clean configurations:
- Remove service definitions from
config/services.xml - Remove routes from
config/routes/*.yaml - Remove twig hooks from
config/twig_hooks/*.yamlor remove entire directory if empty - Remove broken imports from
config/config.yaml - Remove JavaScript imports from
assets/*/entrypoint.js - Remove test suites from
tests/Behat/Resources/suites.yml
- Remove service definitions from
-
Additional cleanup:
- Remove empty directories (e.g.,
config/twig_hooks/if only contains placeholder files) - Check for unused dependencies in
composer.json - Check for unused npm packages in
package.json - Clear cache after cleanup
- Remove empty directories (e.g.,
After cleanup, verify the plugin still works:
# Clear cache
rm -rf var/cache/*
# Check for broken imports in config files
grep -r "twig_hooks\|greeting\|example" config/ --include="*.yaml" --include="*.yml" || echo "No broken imports found"
# Check for syntax errors
vendor/bin/phpstan analyse -c phpstan.neon -l max src/
# Run coding standards check
vendor/bin/ecs check
# If using Docker
make ecs
make phpstan- Controller:
GreetingController.php - Routes:
acme_sylius_example_static_welcome,acme_sylius_example_dynamic_welcome - Templates:
templates/shop/greeting/ - JavaScript:
assets/shop/js/greetings.js - Tests:
*greeting*.feature,*Welcome*.php
- Look for files/classes containing "Demo", "Example", "Sample"
- Check for placeholder routes like
/demo,/example - Remove test data generators if not needed
- Always analyze before deleting - Make sure the code is truly example/demo code
- Check dependencies - Ensure no other code depends on what you're removing
- Keep plugin structure - Don't delete essential plugin files like the main plugin class
- Preserve configuration structure - Keep empty configuration files if they're required by Sylius
Never delete these essential files:
src/[PluginName]Plugin.php(main plugin class)src/DependencyInjection/(directory structure)config/services.xml(keep file, just clean content)config/*_routing.yaml(keep files, just clean content)composer.json,package.json- Essential directories:
src/,config/,templates/,tests/