JorgeeFG
JorgeeFG

Reputation: 5961

Symfony 2.6 new project, problems with Composer

Using the new Symfony installer, I created a project:

symfony new project

Problem Nº 1

Then, I edited the .gitignore file, renaming it to .hgignore (because I am using Mercurial).

Edited the file to suit my needs and PHPStorm made a search for file uses. It found some uses, mostly in Sensio\Bundle\DistributionBundle\Composer\ScriptHandler.php

It seems that this script creates the .gitignore file, which is strange for me. I would like to know WHEN this file is being used, or if it is just a one-time run script.

Problem Nº 2

Trying to test if it is used when using composer, I installed it. Then, following the Symfony How to deploy App tutorial, I entered composer install --no-dev --optimize-autoloader, and then these error came up:

Loading composer repositories with package information
Installing dependencies from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - sensiolabs/security-checker v2.0.1 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - sensiolabs/security-checker v2.0.1 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - Installation request for sensiolabs/security-checker v2.0.1 -> satisfiable by sensiolabs/security-checker[v2.0.1].

Then I ran it again, I don't know why, but it wasn't the same output, it removed a package:

composer install --no-dev --optimize-autoloader
Loading composer repositories with package information
Installing dependencies from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
  - Removing sensio/generator-bundle (v2.5.3)
Generating optimized autoload files
Updating the "app/config/parameters.yml" file
PHP Fatal error:  Class 'Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle' not found in /home/jsivil/Desktop/Proyectos/UNPAZ/secyt/app/AppKernel.php on line 27
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception
      [RuntimeException]                                                         
  An error occurred when executing the "'cache:clear --no-warmup'" command.  

install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [--ignore-platform-reqs] [packages1] ... [packagesN]

Then I ran the composer update:

composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
^[[B  - Removing twig/twig (v1.18.0)
  - Installing twig/twig (v1.18.1)
    Downloading: 100%         

  - Removing doctrine/collections (v1.2)
  - Installing doctrine/collections (v1.3.0)
    Downloading: 100%         

  - Removing doctrine/cache (v1.4.0)
  - Installing doctrine/cache (v1.4.1)
    Downloading: 100%         

  - Removing doctrine/annotations (v1.2.3)
  - Installing doctrine/annotations (v1.2.4)
    Downloading: 100%         

  - Removing doctrine/common (v2.4.2)
  - Installing doctrine/common (v2.5.0)
    Downloading: 100%         

  - Removing sensiolabs/security-checker (v2.0.1)
  - Installing sensiolabs/security-checker (v2.0.2)
    Downloading: 100%         

  - Removing sensio/distribution-bundle (v3.0.20)
  - Installing sensio/distribution-bundle (v3.0.22)
    Downloading: 100%         

  - Removing sensio/framework-extra-bundle (v3.0.6)
  - Installing sensio/framework-extra-bundle (v3.0.7)
    Downloading: 100%         

  - Installing sensio/generator-bundle (v2.5.3)
    Downloading: 100%         

Writing lock file
Generating autoload files
Updating the "app/config/parameters.yml" file
Clearing the cache for the dev environment with debug true
Trying to install assets as symbolic links.
Installing assets for Symfony\Bundle\FrameworkBundle into web/bundles/framework
The assets were installed using symbolic links.
Installing assets for Acme\DemoBundle into web/bundles/acmedemo
The assets were installed using symbolic links.
Installing assets for Sensio\Bundle\DistributionBundle into web/bundles/sensiodistribution
The assets were installed using symbolic links.

It seems to be good now, how can I test if all what is needed is there?

Did I do the right commands?

Thanks.

EDIT:

When I run the composer install thing, PHP Fatal Error comes up again:

composer install --no-dev --optimize-autoloader
Loading composer repositories with package information
Installing dependencies from lock file
  - Removing sensio/generator-bundle (v2.5.3)
Generating optimized autoload files
Updating the "app/config/parameters.yml" file
PHP Fatal error:  Class 'Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle' not found in /home/jsivil/Desktop/Proyectos/UNPAZ/secyt/app/AppKernel.php on line 27
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception    
  [RuntimeException]                                                         
  An error occurred when executing the "'cache:clear --no-warmup'" command.  

install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [--ignore-platform-reqs] [packages1] ... [packagesN]

Upvotes: 1

Views: 479

Answers (2)

John Cartwright
John Cartwright

Reputation: 5084

The command you ran should have been

composer install --optimize-autoloader

instead of

composer install --no-dev --optimize-autoloader

The command you ran included the --no-dev directive, which means it won't import any of your dev dependendies (entries under require-dev in your composer.json).

Your symfony framework is currently running in dev mode, and expects it's dev resources to be installed correctly.

Upvotes: 0

A.L
A.L

Reputation: 10483

It seems to be good now, how can I test if all what is needed is there?

Did I do the right commands?

If you run composer update again composer will check that dependencies are installed, if there is no error it means that everything is installed correctly.


When I run the composer install thing, PHP Fatal Error comes up again:

composer install --no-dev --optimize-autoloader
…
PHP Fatal error:  Class 'Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle' not found in /home/jsivil/Desktop/Proyectos/UNPAZ/secyt/app/AppKernel.php on line 27
…

Once composer has finished to install the packages, it launches some Symfony2 scripts (they are declared in composer.json). SensioGeneratorBundle is called but is not installed.

You can disable these scripts with the --no-scripts option:

composer install --no-dev --optimize-autoloader --no-scripts

This will remove the errors.

Upvotes: 1

Related Questions