Latest Blog Posts

Where have the dependencies gone?

Submitted by Anonymous (not verified) on Wed, 03/02/2016 - 14:40

<p>As of <a href="https://www.drupal.org/node/1475510#comment-10817894&quot; target="_blank">1:23pm GMT on Febuary 3rd 2016</a> there are no dependencies in the Drupal 8.1.x git branch.</p>

<h2>Why?</h2>

<p>There was no reason to have them there. It makes the repository bigger, and therefore takes longer to download. <a href="https://github.com/joomla/joomla-cms&quot; target="_blank">No one</a> <a href="https://github.com/laravel/laravel&quot; target="_blank">else</a> <a href="https://github.com/symfony/symfony&quot; target="_blank">does it</a>.</p>

<h2>What does it mean?</h2>

<p>Not much really.</p>

<p>If you download Drupal via the zip file or tarball then the drupal.org packager will run <code>composer</code> so the dependencies will be there for you.</p>

<p>If you submit a Drupal core patch on drupal.org then DrupalCi testbot will run <code>composer install</code>.</p>

<p>It’s only if you clone Drupal 8.1.x or higher directly from git, you will need to run <code>composer install</code> in the Drupal root directory</p>

<p>Top tip: <code>composer install --prefer-source --no-interaction</code> can often be quicker.</p>

Composer dependencies in Drupal contrib

Submitted by Anonymous (not verified) on Fri, 22/01/2016 - 11:51

<p>Drupal 8 is out, Drupal 8.1 will be out before we know it, but it seems contrib is still catching up. One question that seems to keep coming up is around installing a Drupal 8 module. In this post I will look at the different ways to install a module and resolving dependencies.</p>

<p><a href="https://www.drupal.org/project/deploy&quot; target="_blank">Deploy</a>, <a href="https://www.drupal.org/project/search_api_solr&quot; target="_blank">Search API Solr Search</a>, and <a href="https://www.drupal.org/project/commerce&quot; target="_blank">Commerce</a> are just a few of the modules with Drupal 8 releases that require dependencies loaded via composer. This means you can’t just download the module’s ZIP file, unzip it in your modules directory, and enable it. You need to install the dependencies.</p>

<p>One simple way to do this is the <a href="https://www.drupal.org/project/composer_manager&quot; target="_blank">Composer Manager</a> module. This module has <a href="https://www.drupal.org/node/2405811&quot; target="_blank">extensive documentation</a> on how to use it. Essentially what it does it merge the composer.json that ships with core and the composer.json files from all the contrib module you have, then downloads the dependencies. You may notice that this will also update core dependencies, but this is a good thing! The core composer.json has been written in such a way that it won’t introduce API breaking dependencies and only uses stable releases. So you will benefit from any bug fixes or security fixes rolled out in these dependencies before they’re rolled out with Drupal.</p>

<p>The two other ways we’re going to look at involve directly using Composer.</p>

<p><strong>Just the dependencies</strong><br/>
It’s possible to carry on installing Drupal modules exactly as you always have, download the zip or tarball, then unzip it into your modules directory. As mentioned earlier this will not install the dependencies, therefore you will need to look inside the module’s composer.json file, see what the dependencies are, and install them manually. Let’s take Deploy module as an example, this depends on the dev-master version of <a href="https://packagist.org/packages/relaxedws/replicator&quot; target="_blank">relaxedws/replicator</a>. So, go to your Drupal docroot and run the command <code>composer require relaxedws/replicator:dev-master</code>. This will add relaxedws/replicator to Drupal’s composer.json, download it, and put it in the vendor directory ready for the module to make use of. This will not change any other other dependencies you have. Then to update the dependencies you can either run <code>composer update</code> to update relaxedws/replicator and all core dependencies or <code>composer update relaxedws/replicator</code> to just update the relaxedws/replicator package.</p>

<p><strong>The module too</strong><br/>
If you install all you Drupal modules via composer, all of the dependencies will automatically be installed too. First you will need to add a new repository, so run <code>composer config repositories.drupal composer <a href="https://packagist.drupal-composer.org&quot; target="_blank">https://packagist.drupal-composer.org</a></code&gt; in your Drupal docroot, this will add the <a href="https://packagist.drupal-composer.org&quot; target="_blank">https://packagist.drupal-composer.org</a&gt; repository to your drupal composer.json. Now you can install any module from Drupal.org via composer. So going back to the example of Deploy you can run <code>composer require drupal/deploy:8.1.0-alpha5</code> in your Drupal docroot and it will install Deploy in the modules directory. It will also install key_value, multiversion, and relaxed, which are all Drupal modules required by Deploy. Furthermore it will install relaxedws/replicator as we know is a PHP package needed for Deploy, and doctrine/couchdb which is a PHP package needed for releaxedws/replicator.</p>

<p>I hope this helps those confused what to do with Drupal 8 modules that have composer dependencies. Now go do the smart thing, rebuild your site using Composer!</p>

Putting the M back in CMS

Submitted by Anonymous (not verified) on Mon, 21/12/2015 - 14:16

<p>For the last 6 months I’ve been helping <a href="https://twitter.com/dickolsson&quot; target="_blank">Dick</a> and <a href="https://twitter.com/andreijechiu&quot; target="_blank">Andrei</a> with a number of Drupal modules to enhance the management of content.</p><p><b><a href="http://www.drupal.org/project/multiversion&quot; target="_blank">Multiversion</a></b></p><p>This module enhances the Drupal core Entity API by making all content entities revisionable. Revisions are enabled by default and not optional. This means that edits to users, comments, taxonomy terms etc are created as new revisions.</p><p>Another ground breaking advance is that deleting any of these entities now just archives it. Delete is a flag in the entity object, and just like any other update, it creates a new revision.</p><p>The concept of workspaces has also been added, this allows for a new instance of the site, from a content perspective, can be created. An example use case for workspaces would be to have a dev, stage and production workspace, and move content between them as it gets promoted through the workflow.</p><p><b><a href="https://www.drupal.org/project/trash&quot; target="_blank">Trash</a></b></p><p>Now that deleting content entities just means a new revision marked as deleted we need a way to recover or purge them. The trash module is a UI on top of Multiversion allowing users to do just this.</p><figure class="tmblr-full" data-orig-height="707" data-orig-width="995"><img src="http://68.media.tumblr.com/5906e2ec1b6306f2d57105eb934311e4/tumblr_inli…; data-orig-height="707" data-orig-width="995"/></figure><p><a href="https://www.drupal.org/project/relaxed&quot; target="_blank"><b>Relaxed Web Services</b></a></p><p>Drupal 8 has always been about <a href="http://www.garfieldtech.com/blog/off-the-island-2013&quot; target="_blank">getting off the island</a>, Relaxed Web Services furthers this by getting content off the island. It uses Drupal core’s REST API to expose CouchDB compatible endpoints. This means that replicating content is just a case of using CouchDBs replicator. Then creating a <a href="http://buytaert.net/the-future-of-decoupled-drupal&quot; target="_blank">decoupled Drupal site</a> is as simple as using <a href="http://pouchdb.com/&quot; target="_blank">PouchDB</a>.</p><p>This works really well with Multiversion’s Workspaces, where each workspace is exposed as a separate CouchDB database.</p><p><a href="https://packagist.org/packages/relaxedws/replicator&quot; target="_blank"><b>CouchDB Replicator</b></a></p><p>So that we don’t need to depend on CouchDB for replication, the replicator has been rewritten in PHP. This will allow us replicator content from within Drupal or even via Drush.</p><p><b><a href="https://www.drupal.org/project/deploy&quot; target="_blank">Deploy</a></b></p><p>There is a long history for Deploy in Drupal, but now in Drupal 8 it’s little more than a UI for the PHP based CouchDB replicator. It allows replication of content between workspaces, between Drupal sites, and between CouchDB databases.</p><p><a href="https://www.drupal.org/project/mango&quot; target="_blank"><b>Mango</b></a></p><p>Something we’re currently working on is Mango, inspired by MongoDB and based on <a href="https://github.com/cloudant/mango&quot; target="_blank">Cloudant’s implementation for CouchDB</a>. Mango will allow querying for content entities over the Relaxed Web Services API. This is going to be very interesting to those creating decoupled sites because PouchDB supports the same querying API.</p>