Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8745011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:56:10+00:00 2026-06-13T11:56:10+00:00

This is my composer.json file: require: { php: >=5.4, zendframework/zendframework: 2.*, doctrine/doctrine-module: dev-master, doctrine/doctrine-orm-module:

  • 0

This is my composer.json file:

"require": {
    "php": ">=5.4",
    "zendframework/zendframework": "2.*",
    "doctrine/doctrine-module": "dev-master",
    "doctrine/doctrine-orm-module": "0.*",
    "gedmo/doctrine-extensions": "dev-master"
},
"require-dev": {
    "phpunit/phpunit": "3.7.*"
},
"scripts": {
    "post-update-cmd": [
        "rm -rf vendor/Behat",
        "git clone git://github.com/Behat/Behat.git",
        "cp composer.phar Behat/composer.phar",
        "cd Behat && git submodule update --init",
        "cd Behat && php composer.phar install",
        "cd Behat && php composer.phar require guzzle/guzzle:3.0.*",
        "mv Behat vendor/Behat",
        "ln -sf ../Behat/bin/behat vendor/bin/"
    ]
}

How can I make it so the scripts are only run in the dev environment?

Basically I want the scripts to run only when I call:

php composer.phar update --dev
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:56:11+00:00Added an answer on June 13, 2026 at 11:56 am

    To do the non-development environment update without triggering any scripts, use the --no-scripts command line switch for the update command:

    php composer.phar update --no-scripts
                             ^^^^^^^^^^^^
    

    By default, Composer scripts are only executed1 in the base package2. So you could have one package for development and in the live environment make it a dependency of the live system.

    Apart from that, I do not see any way to differentiate scripts automatically.


    This answer is back from 2012, the additional options in order of appearance can now safely be listed. As the list is composer-only and the original question smells to fall for x/y, the general answer is to use a build manager.

    But turns out this could be done already at the day of asking, as in this composer-json example:

    {
      "scripts": {
        "post-update-cmd": "composer::dev-post-update-cmd",
        "dev-post-update-cmd": [
          "rm -rf vendor/Behat",
          ": ... ",
          "ln -sf ../Behat/bin/behat vendor/bin/"
        ]
      }
    }
    
    • 1.0.0-alpha6 (2012-10-23): dispatch dev-only scripts with PHP script class and __callStatic, e.g. composer::dev-post-update-cmd. if in_array('--dev', $_SERVER['argv']) then $eventDispatcher->dispatchCommandEvent($name).
    • 1.0.0-alpha7 (2013-05-04): --dev is now default and henceforth optional, --no-dev required for not --dev script dispatching. this effectively changes the command-line in question from: composer update --dev running only to: not running on composer update --no-dev. $event->isDevMode() now available, also required for new second parameter on dispatching the script on the event dispatcher. Compare with answer by Christian Koch.
    • 1.0.0-alpha9 (2014-12-07): autoload-dev now allows to not have the script class in --no-dev automatically by removing it from autoload. this works b/c non-existing classes fall-through w/o error.
    • 1.3.0-RC (2016-12-11): --dev is deprecated. COMPOSER_DEV_MODE environment parameter now available in update/install/dumpautoload scripts. no inherit need any longer for the PHP script class, unless enviroment parameters do not work in your setup, then use a PHP class script for a workaround. Compare with answer by Veda.
    • 3 (future): --dev will needlessly make composer fatal, at least this is announced. this closes the circle to pre-1.0.0-alpha7 which also failed on the opposite, --no-dev. the command-line library in use then and yet in the future is not able to cope with -[-not]-args symmetrically, and if the pair is divided and one must go, then it can only throw.

    References

    1. See "Note:" in What is a script? – Scripts – Composer Docs
    2. Base package is commonly referred to as root package in the Composer documentation.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use PhpUnit with Composer. In this purpose I did: 1
This works great: require 'net/http' uri = URI('http://api.twitter.com/1/statuses/user_timeline.json') args = {include_entities: 0, include_rts: 0,
Regarding the audio on this page: http://ebonytay.com/site/composer.php?clip=getOutOfTown#mediaplayer The audio controls show up in Chrome
I am using composer with Symfony 2.0.15 and migrating to latest Behat 2.4. This
This is my Xml output <worklist> <work> <relation-list target-type=artist> <relation type=composer> <name>Пётр Ильич Чайковский</name>
I have this application where I read a sequence of JSON object ... say,
I have a web service with this form: http://<remote_domain_ip>/api/v1/search/?query=the_query Which results a JSON document
I have a Quartz Composer document which I'm trying to edit but since this
What I would like to do is this: play a master quicktime movie (prores
In regards to this Haacked blog , I'm hesitant to implement the proposed anti-JSON

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.