Teaching Research and Publishings Speaking Engagements Professional Development About Me

Server Setup Documents

Setting Up Composer

Install Composer

Composer is a dependency manager for PHP. Composer will help us work as a group together and ensure everyone has the same libraries for both server-side and client-side code.

Open your SSH tool from the Google Cloud admin (not Codeanywhere):

  1. Run any updates your system may need

    sudo apt-get update
  2. Ensure all required packages are installed

    sudo apt-get install curl php-cli
  3. Download and intalls Composer:

    sudo curl -s https://getcomposer.org/installer | php
    sudo mv composer.phar /usr/local/bin/composer
  4. Confirm composer is installed


Add the Vendor Folder to .gitignore

Composer will install PHP libraries to the vendor folder. We want to exclude the vendor folder from the GitHub repository:

  1. In Codeanywhere open your .gitignore file (crate one if needed) and add

  2. Open up the SSH tool using Codeanywhere

  3. Navigate to your project directory

  4. Commit the changes and push to the repository:

    git add -A
    git commit -am "Added .gitignore"
    git push origin master
  5. If you do a pull with a new .gitignore, yo uwill need to clear the cache:

    git rm -r --cached .
    git add .

Add Our First Library

Now that Composer is installed let's add our first library. The only library that we have confirmed using at this point is jQuery, so let’s add that to our dependencies.

  1. Open up the SSH tool using Codeanywhere

  2. Navigate to your project directory

  3. Create a Composer JSON file

    touch composer.json
  4. Open the composer.json file using Codeanywhere

  5. Add jQuery to the list of Required libraries

    "require": {
    "components/jquery": "3.*"
  6. Run composer to include all required libraries:

    composer update