Roots Discourse

Roots Example Project, PHP 7 error notices, and Composer

In my Roots Example Project install, I need a plugin that’s not yet updated to support PHP 7. Thus, after installation of the plugin I get the errors that are breaking the Dashboard.

I ran across Ben’s notice that these messages can be disabled for plugins:

In the example project setup, it doesn’t include anything about installing Composer. After editing the composer.json file and trying to run composer install in the /site/ directory, it reminds me that I don’t have composer installed.

Should the docs for this example project include a link to or instructions about installing Composer? Bedrock even lists composer as a step in the installation of Bedrock but it doesn’t appear in any instructions on the example project. I’m not sure what would change, having already installed the example project and editing the theme, by running composer install now.

I don’t think so, it’s a different concern. For example, should the docs include instructions on how to install node, Vagrant, or even WordPress?

I wasn’t suggesting a the detailed “how-to” instructions, more of a mention that Composer could and very well might be needed in the process.

Technically, if you’re using the full example project, you don’t need to install Composer on your host machine as it is installed on your local VM as part of the Trellis set up.

This means you can use Composer by doing the following:

# go to your project's Trellis folder
# login to the development server
vagrant ssh
# change directory to the current release of your project
cd /srv/www/
# run Composer commands from here
composer update

After you’ve edited the composer.json file you should run composer update to read through the composer.json file and fetch the latest versions (that you’ve specified) of your dependencies.

Composer then writes down exactly which versions you attained through this and “locks” the project to these specific versions by writing a composer.lock file.

composer install ignores the .json file and instead reads the .lock file to guarantee that when your project is deployed it is the same as when you tested it on your development machine.

1 Like