sylius/archetype
Sylius Archetype provides a reusable foundation and conventions for Sylius e-commerce projects, helping developers bootstrap custom stores, plugins, and features faster. It offers sensible defaults, extensible code generation, and integration points for building maintainable, robust online shops.
Sylius/Sylius monorepo, and it is archived. Do not fork it, open PRs against it, or add it to composer.json as a direct dependency. If it is already installed, find out why with composer why sylius/archetype (it usually arrives transitively through Sylius ResourceBundle / Sylius).Archetype (a named bag of templates), a Template (a named artifact with a target path and renderable source), and the manager/factory/renderer that build and render them. Start with ArchetypeInterface, TemplateInterface, then the factory/manager and the renderer. Everything else is glue.sylius:generate:* command wired by ResourceBundle), generate a model or controller, and diff the output against the templates. That teaches you the component's contract faster than reading it abstractly.$archetype = $archetypeFactory->create('book');
$archetype->addTemplate(
$templateFactory->create('class', 'src/Entity/Book.php', '@App/generator/entity.php.twig')
);
foreach ($archetype->getTemplates() as $template) {
$code = $renderer->render($template, [
'namespace' => 'App\Entity',
'class' => 'Book',
]);
$filesystem->dumpFile($template->getPath(), $code);
}
Environment with a FilesystemLoader pointing at your generator templates and strict_variables: true outside production.book, order, invoice) so generated files and service IDs stay predictable.namespace, class, resource_name, bundle, entity, repository) in one factory/service. Every template receives the same keys, which prevents the "works for model, breaks for controller" drift that kills code generators.--dry-run / --force flag. Render into memory (or a temp directory) first, validate all outputs, then write. That gives you atomic-ish generation and a readable diff in CI.vendor/sylius/archetype — the next composer update wipes it.vfsStream or a temp directory for filesystem assertions. Unit-test the context builder separately; it is where most generation bugs hide.Sylius/Sylius. If you rely on a fix, carry a patch (Composer patch plugin) until the monorepo change lands, and plan to drop it.sylius/sylius ships. Trust the version resolved in your lock file (composer show sylius/archetype) and the source under vendor/, not the GitHub repository's default branch.sylius_archetype: YAML to work unless that bundle is installed and wired.namespace or class renders as an empty string and produces subtly broken PHP. Enable strict_variables in dev/CI and assert required context keys before rendering.--force, you either clobber hand-edited code or silently skip regeneration. Decide the policy and test it.%kernel.project_dir%-anchored configuration.How can I help you explore Laravel packages today?