Datasets
A dataset is a catalog ready to be imported: its products and collections (products.yaml, collections.yaml),
their images (media/) and a dataset.yaml describing it. A shop is created from a dataset, then its fixtures are
generated and loaded as usual: several shops can share one dataset, and a dataset is built (AI calls, downloads) once.
cellar/├── dataset.yaml name, description, suggested theme…├── products.yaml image: media/<code>.webp├── collections.yaml└── media/ the images, in WebPIn a dataset, the image of a product or a collection is a path relative to the dataset directory: the
fixtures generation copies it instead of downloading it. A URL still works, and is downloaded.
Ready-made datasets
Section titled “Ready-made datasets”sylius-starter/datasets ships ready-made datasets, images included, so a demo shop needs no AI call nor download:
| Dataset | Catalog | Suggested theme |
|---|---|---|
automotive | Eighteen car parts, tyres, tools and workshop equipment | Torque |
bloom | Eighteen beauty products and tools, on six shelves | Bloom |
cellar | Seventeen wines from fictional estates, in seven regions | Cellar |
culture | Eighteen books, games, instruments and collectibles | Culture |
depot | Eighteen trade supplies and equipment, in six aisles | Depot |
groove | Sixteen fictional vinyl records, in six genres | Groove |
home | Eighteen pieces of furniture, lighting, linen and tableware | Hearth |
outdoor | Eighteen pieces of hiking, climbing and camping gear | Summit |
pets | Eighteen foods, treats, toys, beds and care products for pets | Paws |
retro-gaming | Sixteen retro consoles, games and accessories, on six shelves | Retro Gaming |
roastery | Sixteen specialty coffees and brewing tools, on six shelves | Roastery |
supermarket | Nine everyday groceries, one per supermarket aisle | Drive |
teahouse | Sixteen fine teas and pieces of teaware, on six shelves | Teahouse |
tech | Sixteen devices from fictional brands, in six departments | Tech |
video-games | Sixteen fictional video games, in six genres | Arena |
To add one, drop its directory in src/Datasets/datasets/ (a downloaded dataset has that
layout). Every product needs a local image, a collection may have one (shown on the homepage category tiles): the
package tests check them. Another package can ship its own datasets by registering its directory from an autoloaded
file:
use SyliusStarter\Core\Dataset\DatasetDirectories;
DatasetDirectories::register('my-datasets', __DIR__ . '/../datasets');Build a dataset
Section titled “Build a dataset”castor sylius:import:dataset:build --name="Tea House" --description="Loose leaf teas and tea ware"castor sylius:import:dataset:build --source=existing --name="Tea House" --url=https://www.example-tea.comThe ai source generates the catalog with AI (--limit, 20 products at most); other sources are
registered by the project, such as existing (the fetch of an existing site) in the Sales Kit.
The dataset is written to .castor/import/datasets/<slug>/ (the slug of the name, or --dataset), then the image of
every product and collection is downloaded or generated into its media/. Building it again replaces its catalog.
castor sylius:import:dataset:list # the datasets, with their number of products and imagescastor sylius:import:dataset:images tea-house # download or generate the images still missingcastor sylius:import:dataset:delete tea-house # built datasets only, the shops created from it are keptA source is a callable that writes the catalog of the slug it receives, in an import context whose var dir is the datasets one (the shop import functions then write to the dataset):
use SyliusStarter\Import\Dataset\DatasetBuilders;
DatasetBuilders::register('existing', static function (string $slug, string $name, string $description, ?string $url, int $limit): void { fetch_import_data($url, $name, $description, $slug);});Download a dataset
Section titled “Download a dataset”castor sylius:import:dataset:export cellar # .castor/import/exports/cellar.zipcastor sylius:import:dataset:export tea-house --output=tea.zipThe zip holds a <slug>/ directory: unzipped in src/Datasets/datasets/, it becomes a ready-made dataset.
Create a shop from a dataset
Section titled “Create a shop from a dataset”castor sylius:import:shop:create cellar # shop "cellar"castor sylius:import:shop:create cellar --name="Cave du Port" --description="…" # shop "cave-du-port"castor sylius:import:fixtures:generate --project=cave-du-portcastor sylius:import:fixtures:load --project=cave-du-portThe dataset is copied into .castor/import/var/<shop>/, and project.yaml records the dataset it comes from
(dataset: cellar). The shop then lives on its own: deleting or rebuilding the dataset leaves it unchanged.