Continuous Integration

Install and run PHPCI in Laravel Homestead


  • Time to implement: 15 minutes.

PHPCI is a nifty swiss-army-knife for your development toolbox. It provides continuous integration and connects to popular services like GitHub and BitBucket. It will monitor your source repositories for changes, and trigger a new build when it sees activity. Then it will let you know if anything went wrong or can be improved.

This comes in handy to improve your code quality and minimize errors and issues down the road. In the following section we’ll go through the process of installing PHPCI in Homestead.

A word of caution: it can be unbearibly slow if you install it in the shared folders section. It also helps to have more than 1 processor assigned to Homestead to speed things up.
PHPCI (and other CI tools) are best run on their own server. This guide will help you get PHPCI up and running in Homestead if you don't have a dedicated server to use.


CI is a good way to run automated tasks on your project at regular or pre-defined intervals and perform the following:

  • checks syntax errors
  • checks code style
  • runs unit tests This can be configured to run on commits, pull requests, or push requests to accomodate your development style.

The goal is to improve code quality and catch any issues prior to deployment. If you really trust your tests and CI build process, you might even automatically push to master branch if the build is successful.



  • Homestead 2 (already configured and running)


  1. Add a new database “phpci” to Homestead using your favorite SQL admin tool, maybe something like Sequel Pro.

  2. Open your Terminal, SSH into your homestead VM, and clone phpci to a dedicated folder outside of the shared folder:
    homestead ssh
    cd ~
    git clone

  3. Get all the dependencies:
    cd ~/PHPCI
    composer install

  4. Configure PHPCI:
    ./console phpci:install
    Using the following answers:

    Welcome to PHPCI
    Checking requirements… OK
    Please answer the following questions:
    — — — — — — — — — — — — — — — — — -
    Please enter your MySQL host [localhost]:
    Please enter your MySQL database name [phpci]:
    Please enter your MySQL username [phpci]: homestead
    Please enter your MySQL password: secret
    Your PHPCI URL (“http://phpci.local" for example):
    Setting up your database… OK
    Admin Email:
    Admin Name: Your Name
    Admin Password: yourpassword
    User account created!
  5. Add cron job to automatically run builds:
    sudo env EDITOR=nano crontab -e
    Add the following to the cron file:

    * * * * * sudo php /home/vagrant/PHPCI/console phpci:run-builds
  6. Update MySQL configuration:
    sudo nano /etc/mysql/my.cnf
    (Continue, even if the file doesn’t exist.) And add the following values in the [mysqld] section:

  7. Restart the MySQL service:
    sudo service mysql restart

  8. Update PHP configuration:
    sudo nano /etc/php5/cli/php.ini
    With (leave as is if it is already larger than 1024M):

  9. Let’s exit out of homestead:

  10. Edit homestead config:
    homestead edit
    And add your new PHPCI site:

      — map:
        to: /home/vagrant/PHPCI/public
  11. Update your hosts file:
    sudo nano /etc/hosts
    And add the relevant entry:
  12. Now restart Homestead and provision it:
    homestead halt && homestead up --provision

  13. Open your browser and go to: You should now be able to log in using the email address and password specified in step #4.

  14. From here on in just follow all the same established PHPCI procedures as documented in their wiki:

In a future post I will discuss setting up a Laravel project and showing off all PHPCI can offer.