Symfony Flex: What does symfony.lock file do?

Active3 hr before
Viewed126 times

7 Answers


No, the composer.lock is used for keeping track of the resolution of dependencies in the composer.json. The Symfony recipes are something separate and not mutually exclusive. – gview Sep 17 '18 at 22:40 , Meta Stack Overflow ,Stack Overflow en español,Stack Overflow em Português

It is the proper lock file for Symfony recipes instead of trying to guess via the state of composer.lock

load more v

Using Symfony Flex in New Applications ,Flex keeps tracks of the recipes it installed in a symfony.lock file, which must be committed to your code repository., Symfony Flex Recipes , Projects using Symfony

$ cd my - project /
   $ composer require mailer
load more v

warning: LF will be replaced by CRLF in symfony.lock. The file will have its original line endings in your working directory.,Commit & Push git commit -m "init" git remote add origin https://... git push -u origin master, Commit & Push git commit -m "init" git remote add origin https://... git push -u origin master ,A warning is displayed but symfony.lock still has LF line endings in working copy ✔️

    modified: symfony.lock
load more v

When deploying a fresh installation, a composer install will update all symfony recipes, which changes a bunch of files.,Is it to be expected that the symfony.lock changes with a composer install ?,run composer install - nothing should change,After a composer install on the staging server, the symfony.lock changed:

I can't really reproduce it with a new project, either and I can't share the composer.json of our internal tools, so I'm not too sure how to answer. We had a symfony.lock with the following package missing:

"laminas/laminas-diagnostics": {
   "version": "1.6.0"
load more v

How did this get here? It was added by the symfony/flex recipe! More about this file later.,Next, look at symfony.lock. This file is managed by Flex: it keeps track of which recipes were installed. You should commit it, but not think about it.,Seriously, do this. Composer recently released a bug fix that helps Flex.,Ha! Flex even installed a recipe for itself! What an over-achiever! Let's find out what it did:

composer self - update
load more v

Flex keeps track of the recipes it installed in a symfony.lock file that must be committed to your code repository. Recipes are stored in two different GitHub repositories:,Recipe is a curated list of recipes for maintained, high quality packages. Symfony Flex looks into this repository by default., Recipe is a curated list of recipes for maintained, high quality packages. Symfony Flex looks into this repository by default. ,vendor/ – External libraries installed by the composer.

In order to create a new Symfony 4 application, you need to have PHP 7.1 (or higher) and Composer installed. With Composer installed, you can create the project by launching this command into your console:

composer create - project Symfony / website - skeleton my - project

This is the command used for traditional web applications that download a Symfony project’s base skeleton with a ready-to-start default configuration. If you are building microservices, console applications, or APIs, consider using the much simpler skeleton project:

composer create - project symfony / skeleton my - project
load more v

# you can also select an exact specific Symfony version,You can also add Symfony Flex to an existing project.,Optionally, you can also install Symfony CLI. This creates a binary called symfony that provides all the tools you need to develop and run your Symfony application locally.,How to Install or Upgrade to the Latest, Unreleased Symfony Version

The symfony binary also provides a tool to check if your computer meets all requirements. Open your console terminal and run this command:

$ symfony check: requirements
load more v

Other "symfony-undefined" queries related to "Symfony Flex: What does symfony.lock file do?"