Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to properly change what composer or Symfony2 does after running 'composer update/install'?

There are some scripts that are executed after I run composer.

The problem is that they do things that I don't want, like php assets:install (without --symlink).

So I need to either be able to remove that, or add my own script to do php assets:install --symlink.

What would be the correct way for doing this?

EDIT

In Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets() I can see an option for symlink:

if ($options['symfony-assets-install'] == 'symlink') {
    $symlink = '--symlink ';

Is that configurable somewhere?

like image 461
ChocoDeveloper Avatar asked Aug 25 '12 15:08

ChocoDeveloper


People also ask

Does composer update also install?

When you run composer update command it simply process the composer. json file and install dependencies, And creates the composer. lock file with updated dependencies. It does not process the composer.

How do I update the composer package to the latest version?

To update your packagesNavigate to the root of your git repo, where your composer. json file is. Run composer update (on your local machine) to update the required packages and re-generate a composer. lock file.


2 Answers

To install assets with symlinks edit your composer.json (at the end) in this way

"extra": {
    "symfony-app-dir": "app",
    "symfony-web-dir": "web",
    "symfony-assets-install": "symlink"
}

Then run composer as uusal.

like image 199
mgiagnoni Avatar answered Sep 17 '22 20:09

mgiagnoni


If you use composer to deploy to production environments, you may want to set the environment variable SYMFONY_ASSETS_INSTALL to symlink instead. This way production still uses hard copies which is the recommended option.

like image 21
Marcus Pope Avatar answered Sep 19 '22 20:09

Marcus Pope