2

My goal is to try updating drupal/core with Composer and to learn composer basics. Composer is installed on OS X. From terminal i can run

My-MacBook-Pro:~ osxuser$ composer
   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version 1.4.1 2017-03-10 09:29:45

Usage:
command [options] [arguments]...

So how do I make composer find my drupal8 install in Mamp?

I have tried both:

composer -d, --working-dir=/Applications/MAMP/htdocs/test_d8

and

cd /Applications/MAMP/htdocs/test_d8

If I am running several drupal 8 installs in /Applications/MAMP/htdocs/ how do I tell composer witch one to work on?

From what I've red you don't need drush any more. I am not sure Composer has all it needs to work with Drupal 8 either.

composer show
symfony/css-selector      v3.2.6  Symfony CssSelector Component
symfony/dom-crawler       v2.8.13 Symfony DomCrawler Component
symfony/finder            v3.2.6  Symfony Finder Component
symfony/polyfill-mbstring v1.3.0  Symfony polyfill for the Mbstring extension

composer diagnose
Checking composer.json: WARNING
No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.
require.symfony/dom-crawler : exact version constraints (2.8.13) should be avoided if the package follows semantic versioning
Checking platform settings: WARNING
The OpenSSL library (0.9.8zc) used by PHP does not support TLSv1.2 or TLSv1.1.
If possible you should upgrade OpenSSL to version 1.0.1 or above.

Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking pubkeys: 
Tags Public Key Fingerprint: ---numbers here---
Dev Public Key Fingerprint: ---numbers here---
OK
Checking composer version: OK

Can someone point me in the right direction here? Do I need to use/install other composer submodules/libraries?

Is it possible to do some sort of composer update drupal/core --dry-run as a test?

  • 1
    You run composer from the project directory, which is where your composer.json lives. I can work on any project at any time in the CLI by cd ing to the project I want to work on. Composer understands that that is the working directory in that execution. At least that is how I do it. – Kevin Mar 23 '17 at 15:35
  • Composer just uses the composer.json and composer.lock files it finds in the current directory, as @Kevin said. Drupal doesn't need any other Composer plugins, if not the ones listed in its composer.json file. You could use the plugin that updates also some other files like index.php and update.php, but that is not strictly necessary. Just know that without that plugin there are files you should manually update. – kiamlaluno Mar 23 '17 at 17:32
  • Thanks. What's the name of the plugin for index.php/update.php file? This one? github.com/drupal-composer/drupal-scaffold – that drupal-scaffold/composer.lock looks massive (!?) Not exactly newbie stuff ;-) Hope I won't have problems with the old OpenSSL library. – eye-wonder Mar 24 '17 at 8:30
3

Posting as an answer instead of a comment.

You run Composer from the project directory, which is where your composer.json and .lock file (which will get generated for you) lives.

I can work on any project at any time in the CLI by cd ing to the project I want to work on. Composer understands that this is the working directory in that execution.

So, no matter where you are in your server, Composer will execute in the directory you are currently in.

  • Thanks. So I actually did it right already. I assumed composer did not work against the right folder when I got this message. My-MacBook-Pro:test_d8 osxuser$ composer update drupal/core --dry-run Package "drupal/core" listed for update is not installed. Ignoring. Loading composer repositories with package information Updating dependencies (including require-dev) – eye-wonder Mar 23 '17 at 19:37
  • Updating drupal is a bit different. See: drupal.stackexchange.com/a/207502/57 – Kevin Mar 23 '17 at 19:39
  • I was able to do a test after updating the composer.json file and moving "drupal/core": "~8.02" to require. Got a lot of messages about guzzlehttp/guzzle. Well I am several steps further now. Marking your answer correct. Thanks! – eye-wonder Mar 23 '17 at 20:18
  • In theory: can I also CD into a drupal root on a remote server using SSH (shared hosting)? Or do I need to install stuff on the remote server before I use composer? – eye-wonder Mar 24 '17 at 8:40
  • composer would need to exist on the server. See: stackoverflow.com/a/17013169/295112 – Kevin Mar 24 '17 at 14:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.