DEV Community

William Arin
William Arin

Posted on

Cook: an alternative to Symfony Flex to execute package-embedded recipes for any PHP project

For the devs out there not working with Symfony, Flex is a Composer plugin that allows to automate Symfony plugins configuration with a recipe, which is a list of things to configure.

It works by fetching a separate repository containing the recipe, either hosted by Symfony in symfony/recipes and symfony/recipes-contrib, or self-hosted with some extra steps required. It's good and it works. But it could be better: embedded in repositories. Unfortunately the Symfony team doesn't plan on adding this feature. It's been rejected here, here and here.

While I totally respect their decision, I don't really understand the reasoning. We're left with one option: separate recipe repository. It would be nice if we had all options available, and we're missing the package-embedded one. And so I tried to fill this gap.

Introducing Cook.

Cook is a Composer plugin that executes recipes embedded in packages. It can be used alongside with Flex, or in any other PHP project not limited to Symfony, as long as Composer is installed.

Features:

  • Add new entries to arrays or export new arrays, filter how you want to output it
  • Add content to existing files or create them (.env, .gitignore, Makefile, or anything else)
  • Copy entire directories from your repository to the project
  • Keep existing data by default or overwrite it with a CLI command
  • Supports PHP arrays, JSON, YAML, text files
  • Output post install instructions
  • Process only required packages in the root project
  • Uninstall recipe when a package is removed
  • CLI commands to install or uninstall recipes

Basically it's Flex without Flex.

Here's the repository with full documentation:

GitHub logo williarin / cook

Composer plugin to execute recipes embedded in packages

Cook

Baking recipes for any PHP package.

Github Workflow

Introduction

Cook is a Composer plugin that executes recipes embedded in packages, in a similar fashion to Symfony Flex It can be used alongside with Flex, or in any other PHP project, as long as Composer is installed.

Features

  • Add new entries to arrays or export new arrays, filter how you want to output it
  • Add content to existing files or create them (.env, Makefile, or anything else)
  • Copy entire directories from your repository to the project
  • Keep existing data by default or overwrite it with a CLI command
  • Supports PHP arrays, JSON, YAML, text files
  • Output post install instructions
  • Process only required packages in the root project
  • Uninstall recipe when a package is removed
  • CLI commands to…

Please give a star if you like it!

Latest comments (0)