User login

Using composer require to get an alpha, beta, or release candidate of a Drupal 8 module

The composer require command can help you get your requirements into composer.json more easily. However, that ease is more theoretical than actual for modules without a full stable release.

The Honeypot module has a full stable release version, so any of these will work:

composer require drupal/honeypot:8.*
composer require drupal/honeypot:8.x
composer require drupal/honeypot:8
composer require drupal/honeypot

But at the time of this writing, the current release of the Default content module is 8.x-1.0-alpha2. How is that supposed to look? It's a lot less forgiving than one that has a full release. To end the suspense, here is what default_content 8.x-1.0-alpha2 translated for composer looks like:

composer require drupal/default_content:8.1.0-alpha2

Of course, you can always look up what packages (modules, themes, profiles) are available at https://packagist.drupal-composer.org/ and get the full require line that way. Here, for instance, is the page for https://packagist.drupal-composer.org/packages/drupal/default_content

That's a lot easier than trying to guess the version string as used by composer and getting messages like '[UnexpectedValueException] Could not parse version constraint 8.-1.: Invalid version string "8.-1.'

Searched words: 
drupal 8 composer require cannot find alpha

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Syntax highlight code surrounded by the {syntaxhighlighter SPEC}...{/syntaxhighlighter} tags, where SPEC is a Syntaxhighlighter options string or "class="OPTIONS" title="the title".
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.