castor-php / sylius
Castor plugin for Sylius
Requires
- php: >=8.3
- castor-php/docker: ^0.6.0
- symfony/ai-ollama-platform: ^0.12.0
- symfony/ai-open-router-platform: ^0.12.0
- symfony/ai-platform: ^0.12.0
- symfony/dotenv: ^7.4|^8.0
- symfony/http-client: ^7.4|^8.0
- symfony/yaml: ^7.4|^8.0
Requires (Dev)
- jolicode/castor: ^1.6
- phpunit/phpunit: ^13.2
Suggests
- jolicode/castor-api: Expose import tasks over HTTP
Provides
None
Conflicts
None
Replaces
None
- dev-main
- dev-b2b/security-access
- dev-improve-readme-for-customer-approval
- dev-admin-dashboard-pending-actions
- dev-customer-validation-grid-mutator
- dev-refactor-features
- dev-improve-readme-with-screenshots
- dev-improve-b2b-command
- dev-theme-readme
- dev-footer-fix
- dev-interactive-build
- dev-improve-ai-readme
- dev-fix-cache
- dev-import-commands
This package is auto-updated.
Last update: 2026-09-25 15:38:36 UTC
README
A Castor plugin that turns a PHP description of your stack into a Sylius app, and gives you the tasks to drive it.
Installation
-
Create a
castor.phpfile in your project root: -
Create a composer file for Castor:
echo '{}' > castor.composer.json
- Install the Castor plugin for Sylius
castor composer require castor-php/sylius "@dev"
- Setup a new Sylius application
castor docker:service:install sylius
🦫 Available commands
Add or Remove plugins
Install or uninstall Sylius plugins with simple commands.
Note: Payment gateways are managed separately with
sylius:payment-gateways:setup.
✚ Add plugins
A single command to add all the Sylius plugins you need.
Example:
castor sylius:add cms invoicing refund
Available plugins
| Plugin | Description |
|---|---|
| bugsnag | Add the Symfony BugSnag plugin |
| cms | Add the Sylius CMS plugin |
| gdpr | Add the Synolia GDPR plugin |
| invoicing | Add the Sylius Invoicing plugin |
| media | Add the Jolicode Media plugin |
| product_bundle | Add the Sylius Product Bundle plugin |
| refund | Add the Sylius Refund plugin |
| wishlist | Add the Sylius Wishlist plugin |
❌ Remove plugins
A single command to remove the Sylius plugins you do not need anymore.
Example:
castor sylius:remove invoicing cms
Available plugins
| Plugin | Description |
|---|---|
| bugsnag | Remove the Symfony BugSnag plugin |
| cms | Remove the Sylius CMS plugin |
| gdpr | Remove the Synolia GDPR plugin |
| invoicing | Remove the Sylius Invoicing plugin |
| wishlist | Remove the Sylius Wishlist plugin |
💳 Setup payment gateways
Configure which payment gateways are active in your Sylius application.
Note: Payment gateways have their own dedicated command and are not managed through
sylius:add/sylius:removeby design.
A single command to setup which payment gateways you want to use in your Sylius application. By default, only installs
the
selected gateways. Pass --only to also remove unselected gateways.
Example:
castor sylius:payment-gateways:setup stripe
You can also pass multiple gateways:
castor sylius:payment-gateways:setup paypal stripe
If no arguments are provided, an interactive prompt will ask you to choose the payment gateways.
Remove unselected gateways:
castor sylius:payment-gateways:setup --only stripe
Available payment gateways
| Gateway | Description |
|---|---|
| mollie | Setup Sylius Mollie payment gateway |
| paypal | Setup Sylius Paypal payment gateway |
| stripe | Setup Sylius Stripe payment gateway |
🎨 Setup a theme
Install a storefront theme in your Sylius application. Only one theme can be active: installing a theme automatically removes any other previously installed theme.
If no argument is provided, an interactive prompt will ask you to choose the theme.
Example:
castor sylius:theme:setup canvas
Available themes
| Theme | Description |
|---|---|
| canvas | Install the Canvas storefront theme |
| default | No theme applied; rebuilds the application assets |
☰ Remove menu items from the Admin panel
Clean up the Sylius Admin panel by removing menu items you don't need.
This command generates application/src/Menu/Admin/RemoveMenuItemsListener.php, a Symfony
event listener that hides matching items from the admin main menu. Subsequent runs
automatically merge new items into the existing list without prompting.
Pass one or more menu item names as arguments. Use parent/child syntax for sub-items.
Example:
castor sylius:menu:remove official_support sylius.ui.administration castor sylius:menu:remove marketing/product_reviews
Available options
| Option | Shortcut | Description |
|---|---|---|
| --replace | -r | Replace the full removed-items list instead of merging with existing items |
| --restore | -b | Restore previously removed menu items; deletes the listener when the list is empty |
Replace the removed-items list:
castor sylius:menu:remove customers orders --replace
Restore previously removed items:
castor sylius:menu:remove --restore customers castor sylius:menu:remove -b customers orders
Example workflow:
# Hide customers and orders from the admin menu castor sylius:menu:remove customers orders # Later, hide product reviews too (auto-merged) castor sylius:menu:remove marketing/product_reviews # Restore the customers menu item castor sylius:menu:remove -b customers
Default menu items
Top-level items:
| Name | Description |
|---|---|
| dashboard | Dashboard |
| catalog | Catalog |
| sales | Sales |
| customers | Customers |
| marketing | Marketing |
| configuration | Configuration |
| official_support | Official Support |
| sylius.ui.administration | Administration |
Sub-items (use parent/child syntax):
| Name | Description |
|---|---|
| catalog/taxons | Taxons |
| catalog/products | Products |
| catalog/inventory | Inventory |
| catalog/attributes | Attributes |
| catalog/options | Options |
| catalog/association_types | Association Types |
| sales/orders | Orders |
| sales/payments | Payments |
| sales/shipments | Shipments |
| customers/customers | Customers |
| customers/groups | Groups |
| marketing/promotions | Promotions |
| marketing/catalog_promotions | Catalog Promotions |
| marketing/product_reviews | Product Reviews |
| configuration/channels | Channels |
| configuration/countries | Countries |
| configuration/zones | Zones |
| configuration/currencies | Currencies |
| configuration/exchange_rates | Exchange Rates |
| configuration/locales | Locales |
| configuration/payment_methods | Payment Methods |
| configuration/shipping_methods | Shipping Methods |
| configuration/shipping_categories | Shipping Categories |
| configuration/tax_categories | Tax Categories |
| configuration/tax_rates | Tax Rates |
| configuration/admin_users | Admin Users |
| official_support/sylius_plus | Sylius Plus |
| official_support/browse_plugins | Browse Plugins |
| official_support/professional_services | Professional Services |
| official_support/find_a_partner | Find a Partner |
| official_support/sylius_certification | Sylius Certification |
| sylius.ui.administration/roles | Roles |
💼 Enable B2B features
Turn on B2B features for your Sylius shop. Pass one or more feature identifiers as arguments:
castor sylius:b2b:enable hide_prices hide_checkout customer_validation
If no arguments are provided, an interactive choice lets you select the features to enable.
Note: The command copies the matching resources into your application.
Examples
Available features
| Feature | Description |
|---|---|
hide_prices |
Hide prices for anonymous users |
hide_checkout |
Hide the checkout for anonymous users |
customer_validation |
Require admin approval before customers can sign in |
Hide prices for anonymous users
Hides product prices (product cards and product details page) from visitors who are not logged in. Prices remain visible to logged-in customers.
Hide checkout for anonymous users
Removes the "Add to cart" button on the product details page, hides the cart from the header, and blanks the cart summary page for guests.
Admin validation for new users
Require an administrator to approve new customers before they can sign in. Enable the feature with:
castor sylius:b2b:enable customer_validation
New customers are created disabled and start in the customer_validation workflow (new → accepted /
rejected). The automatic registration email is suppressed until a customer is accepted.
In the Admin panel, this feature:
- adds
state,localeCodeandregistrationChannelfields to theCustomerentity; - displays the validation state in the customer grid, with a filter for
new,acceptedandrejected; - adds Accept / Reject actions to the customer grid and customer show page;
- displays a count of customers waiting for validation in the dashboard pending actions;
- generates a Doctrine migration for the new columns and prompts you to run it (you can run it later if you decline);
- enables the user and sends the registration email when a customer is accepted;
- leaves the user disabled when a customer is rejected.
The package autoloads via Composer. Do not import('composer://castor-php/sylius') — that would load the package's
local castor.php and conflict with your own context. Register SyliusService as shown above to expose all tasks (
sylius:*, app:*, sylius:import:*).
E-commerce import
Import products, collections, images and prices from an AI-generated catalog, or load YAML produced by an external fetch step into Sylius fixtures.
Prerequisites
-
Make sure you have already set up your Sylius application using the
castor docker:service:install syliuscommand. -
Configure AI in .castor/.env (created automatically when you run the first import command). You can copy the default values from .castor/.env.example.
You can also create a .castor/.env.local file for your sensitive values or local overrides.
| Variable | Default | Description |
|---|---|---|
AI_PROVIDER |
openrouter |
ollama (local) or openrouter |
AI_MODEL |
provider-specific | Text / structured-output model |
AI_IMAGE_MODEL |
provider-specific | Image generation model (AI import only) |
AI_BASE_URL |
http://127.0.0.1:11434 |
Ollama URL (ignored for OpenRouter) |
AI_API_KEY |
— | Required when AI_PROVIDER=openrouter |
AI Generated Catalog
Generate a catalog from a description
Generate a complete product catalog from a natural-language description using AI. The generated catalog is saved as YAML and can then be used to generate Sylius fixtures.
castor sylius:import:ai:build \
--name="Organic Kids" \
--description="An online store selling organic clothes for children"
This will generate a catalog for Organic Kids, including products and collections, based on the provided description.
Import data is stored per project slug under .castor/import/var/{project-slug}/.
Generate the Sylius fixtures files
castor sylius:import:fixtures:generate ai --project="Organic Kids" --limit=100
Load the fixture suite
castor sylius:import:fixtures:load --project="Organic Kids"
Using data from an existing website
It requires a YAML import under .castor/import/var/{project-slug}/ (products + collections). If you use the private
castor-php/sylius-import-fetch plugin, run sylius:import:existing:fetch first; otherwise prepare the YAML yourself.
castor sylius:import:fixtures:generate existing --project=example --limit=100 castor sylius:import:fixtures:load --project=example
License
This plugin is part of the Castor project, released under the MIT license.