Enabling modules with Drush
Now, I'd like to point out that Composer is fantastic for managing dependencies. It will recursively check the dependencies of the dependencies of the dependencies (and so on) of anything you require. It has nothing inherently to do with Drupal, however, so we still need to enable anything we install. I'll go ahead and enable Admin Toolbar and Admin Toolbar Tools with Drush.
drush en -y admin_toolbar admin_toolbar_tools
How to Decide Which Version Pattern to Use
These version patterns can get confusing, so here's a little table I created to help you decide what you should type.
What version do you want? | Version Pattern to type |
---|---|
Latest stable that is greater than or equal to 1.0 (This includes alphas, betas etc. until the initial full release) |
^1.0 |
Always Dev (ignore stables) | 1.x-dev |
Exact version | 1.14 |
A Quick Note About Upper Limits
If you look in the "require" section of composer.json, you'll see some version numbers begin with a "~" (tilde) (like "jcalderonzumba/gastonjs": "~1.0.2"
) and some begin with a "^" (caret) (like "composer/installers": "^1.0.20"
). These mean almost the same thing, but produce different results based on whether or not semantic versioning is desired.
~1.0
and ^1.0
will produce the exact same result every time. ~1.0.0
and ^1.0.0
however will not. The difference is in the upper limit allowed by each operator.
The "~" (tilde) allows only the last provided number to increase, while the "^" allows anything after the "major version" number to increase.
So in the first example, there is only one number after the major version number, so they both allow the "0" to increase indefinitely to something like "1.99".
The second example uses semantic versioning, so since the "~" (tilde) only allows the last provided number to increase, the highest version number allowed will be something like "1.0.99".
While the "^" (caret) allows any number after the major version to increase, so the highest version number allowed would be something like "1.99.99".
Because we are using semantic versioning (or at least transitioning to using semantic versioning) the "^" (caret) is probably what you want to use most often for installing Drupal projects (like modules and themes).