I think your confusion comes from the assumption there must be only one way of developing software "the right way". To my experience, that's a pretty unjustfied assumption.
Different teams and organizations are having different ways of working, and a high-frequency continuous-delivery pipeline maybe great for some teams, but not for others.
The --no-dev
option from Composer aims for a process where the team uses packages which are required as dependencies for full developing, debugging and testing, but not for running the software in production. That can indeed mean to
This allows, for example, to implement certain kind of tests by using tools which would otherwise not be available, or tests which produce more detailed debugging information when they fail, so making it easier to find the root cause of a certain failure. However, this comes for the cost of a certain risk of creating code which runs fine before packaging, but not afterwards, if one is not be careful enough.
When going towards a CD pipeline, however, Dave Farley recommends a process where lots of the tests - specificially the automated ones - are run after packaging (with --no-dev
). That means, there still might be some additional dev packages necessary for developing and debugging, but non for testing (at least not beyond "explorative testing"), and none of the automated tests should require additional dependencies in the "subject under test". This all aims at a higher throughput, but it may require to write tests differently, have more tests at all, and may require a better design of the software towards testability.
So in short, I would not read the Composer options of a "recommendation" to use extra dev dependencies for testing - it is an option you can make use of, if it fits to your development process, and not make use of it, when it doesn't.
Note also even when the team is using extra dependencies for testing, this does not necessarily mean to package "twice" - the tests in this scenario can be run perfectly without any packaging at all. However, for larger products, developed by several subteams, it may become useful to use packaged libraries from other teams - that is the scenario described in Bart van Ingen Schenau's answer: for development, the subteams share "dev-packages" (created without --no-dev
), but when it comes to push code into the CI pipeline, only --no-dev
packages are used.