Recipe Tooling
When to Use
Use recipe tooling when you need to apply recipes, export content, or integrate recipes into custom workflows.
Tools for applying, testing, and developing recipes.
Items: Recipe Commands and APIs
drush recipe
Description: Apply recipe via Drush Usage:
drush recipe recipes/my_recipe
drush recipe /path/to/recipe
drush recipe myorg/my-recipe # Composer package
core/scripts/drupal recipe
Description: Apply recipe via core PHP script (no Drush) Usage:
php core/scripts/drupal recipe recipes/my_recipe
php core/scripts/drupal recipe core/recipes/standard -v
-v flag outputs step-by-step progress; useful for CI/automated installs; prompts via Symfony Console
core/scripts/drupal quick-start
Description: Install Drupal from scratch using a recipe (no install profile required) Usage:
php core/scripts/drupal quick-start core/recipes/article_content_type
drush content:export
Description: Export content entities to YAML Usage:
drush content:export node 123 recipes/my_recipe/content --dependencies
drush content:export media 456 recipes/my_recipe/content
RecipeRunner::processRecipe()
Description: Programmatically apply recipe Usage:
use Drupal\Core\Recipe\Recipe;
use Drupal\Core\Recipe\RecipeRunner;
$recipe = Recipe::createFromDirectory('/path/to/recipe');
RecipeRunner::processRecipe($recipe);
RecipeRunner::toBatchOperations()
Description: Convert recipe to batch operations Usage:
$recipe = Recipe::createFromDirectory('/path/to/recipe');
$operations = RecipeRunner::toBatchOperations($recipe);
$batch = [
'operations' => $operations,
'finished' => 'recipe_batch_finished',
];
batch_set($batch);
Common Mistakes
- Using old Drush versions → Recipe support requires Drush 12+; earlier versions don't have recipe command
- Not handling batch callbacks → toBatchOperations requires custom finished callback; see core examples
- Applying recipes in wrong environment → Recipes modify active config; test in safe environment first
- Assuming Drush is only option → Core script works without Drush; good for Docker/CI
- Forgetting to clear cache after manual application → Config changes may not take effect until cache clear
See Also
- Previous: ← Composer Integration & Publishing
- Next: Core Recipes Catalog →
- Reference:
core/lib/Drupal/Core/Recipe/RecipeRunner.php