Symfony Flex – Private Recipes 2019

Since my last article about private recipes with Symfony Flex got many interested readers, I would like to give you an update on how to use private recipes in 2019.

Background

Unfortunately, SensioLabs has removed the private recipes feature from the official Symfony Flex Server (which was Beta in the last state), so we can not use this feature out-of-the-box anymore.

As I found out at the PHP-Meetup in Berlin, where I gave a talk about this topic, we had some staff from SensioLabs which confirmed that possibly this feature will be an enterprise commercial feature in the future.

Workaround

As I run into this issue myself I investigated some time and found a non-official Symfony Flex Server which implemented the Flex API itself on GitHub.

There were some pitfalls for beginners which I was happy to solve by submitting some PRs to the projects.

The service itself acts as a proxy between the official/contrib recipes (from symfony.sh) and injects your private recipes into the API.

Requirements

The flex server is based on Symfony 4 itself so the requirements are basically the one from Symfony. Additionally, you need a web server that serves the application reachable from your machines (e.g. Nginx).

You can find the full requirements from flex server here.

Installation

You can clone the repository or download the latest release from GitHub. (This will not contain some fixes – so currently I recommend you to use the master-branch.)

After checkout you need to install the dependencies with composer:

Now you should check your configuration .env file in project-root. There you can configure the private-recipe repository and decide if you want to mirror official and/or contrib recipes that are enabled by default and recommended.

Now you can run the flex-server command to initialize the repositories locally:

Now you can see your personal flex-server overview by calling your webserver-configure URL. This should look like this:

As you can see in the screenshot, down the recipe-name you can see the type of recipe which can be official, contrib and private.

Summary

There is currently a good workaround to have private recipes without paying for it or doing the same stuff manually each time.

The only downside is that as it is an unofficial project, the flex-api and the flex-server are not synced actively. So you rely on the developer or yourself in case something big changes.

Normally the benefit of having a running solution is higher than the risk in my opinion, as in the last consequence if all fails you could write yourself an alternative as composer-script automating these tasks and dropping usage of flex-server.

Für neue Blogupdates anmelden:


Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.