Getting started with PHP and Bamboo

This page describes how to use Bamboo to get rapid feedback on your PHP project. The worked example builds a Bamboo plan where a developer commits code and Bamboo responds by:

  • Connecting to the code repository
  • Checking out the source code
  • Compiling the code
  • Running unit and integration tests
  • Reporting back test results

Information you need before you begin

This introduction assumes you are using Bamboo Server installed on your local network. You need to make sure you or your company administrator have properly installed and configured Bamboo for running plans.

You will also need to install:

  • The PHP framework
  • PHPUnit testing framework

Step 1: Install the PHP base code framework

In order to get full functionality from Bamboo and PHP, you will need to install the PHP base code framework. If you are using Ubuntu, then use the following command to install PHP.

See also:

Step 2: Install PHPUnit provides an excellent PHP archive resource called PHAR.

If you prefer, you may use Composer or PEAR to download and install PHPUnit along with its dependencies, however these approaches are beyond the scope of this introduction.

Step 3. Create a project and plan

1. Create a new project

A Bamboo plan defines the details of your continuous integration workflow.  You use a plan to identify the source code repository, specify the tasks to run in your build, and when to trigger a build.  Each plan belongs to a project.  You can add a plan to an existing project or create a new project. In this example, you create both a new project and a new plan in that project.

  1. Log into your Bamboo instance as a user with permissions to create plans.
  2. Choose Create > Create a New Plan from the menu bar.

Every plan belongs to a project. We don't have a project yet, so choose Project > New Project, and enter details for both the project and plan.

Project New Project
Project Name TestProject
Project Key TP

2. Configure the plan details

Bamboo needs to know the Plan name, Plan key and a brief description of what the plan is for. See Configuring plans for more details.

Plan name Tutorials
Plan key TUT
Description Build Atlassian tutorials

3. Choose a source repository

Bamboo needs to know where the source code repository is located, and needs access to the repo so that it can check out the code when it runs a build. See Linking to source code repositories for more details.

Source Repository Bitbucket
Username Your Bitbucket username
Password Your Bitbucket password
Repository atlassian_tutorial/hellworld (git)
Branch master
Use shallow clones Set this checkbox

4. Triggering the build

We can choose how Bamboo gets triggered to run the plan build:

Trigger type Repository triggers the build when changes are comitted
Trigger IP Optionally add an IP address for your repository

See Triggering builds for more details.

Step 4. Configure tasks

Each plan needs to have at least one task specified. Tasks do the real work of the plan.

The source code checkout task

A newly created plan has a default Source Code Checkout task that gets the source code from the source repository specified earlier.

See Checking out code for details.

Unit testing

Unit testing for PHP is completed using the PHPUnit testing framework. This is a port of the popular Java JUnit testing framework to PHP. PHPUnit provides also produces test results in the JUnit XML format required by Bamboo.

You will need to add a server executable capability to run PHPUnit:

  1. Go to Overview > Server capabilities.
  2. Click Add capability and complete the configuration using the following:

    Capability type Executable
    Type PHPUnit
    Executable label PHPUnit x.x
    Path Path to the PHPUnit executable e.g. /usr/bin/phpunit-x.x
  3. Click Add to add the PHPUnit capability.

Now you can create a PHPUnit testing task:


Getting the test results

Your tests will be run when the builder task compiles the code. Each of the builder tasks above has a section to tell Bamboo to expect test results and where to look for them. You can specify a custom results location if your project directory doesn't use the conventional structure.

See Jobs and tasks for details.

Step 5: Go!

Enable the plan, and click Create.

You should see the plan run. The 'Plan Summary' tab will report whether the build succeeded or not.

Tests in the appropriate directory in the source code repository will be run automatically as part of the build, and the test results will be displayed in Bamboo.

Now, whenever you commit a change to the repository, Bamboo will build your source code and report on your test results.

Get feedback

Bamboo displays a summary of the results of the build on the dashboard.

You can get further information about the build in the following ways:

  • Build results for one or more plans can be displayed on a wallboard.
  • You can get notifications about build results sent to you by email, IM and RSS feed.
  • You can get build statistics about plans, and about developers contributing code to the build.
  • You can drill down into the results to see the code changes that triggered the build, and the tests that were run for that build.

See Getting feedback for details.

Was this helpful?

Thanks for your feedback!

Why was this unhelpful?

14 Archived comments

  1. User avatar


    Please create documentation

    07 Nov 2012
  2. User avatar


    Please documentate. I'm THIS close to leave the service since I can't figure out to use it !

    14 Nov 2012
  3. User avatar


    Nice joke... I've spent couple of hours to install and put Bamboo behind proxy (because it's not like JIRA or Stash... No that would be to easy) and now I'm finding out that "Getting started with PHP and Bamboo" is a stub and marked as a minor task. And we all know how few PHP programmers are out ther... (facepalm).

    19 Nov 2012
  4. User avatar


    Writing this page cannot be that difficult and it's poor that the stub was even created. Why get bother creating the page for people only to get annoyed that you haven't bother to populate it yet.

    06 Dec 2012
  5. User avatar


    It must be very similar to: Getting started with Java and Bamboo. I have to hack through it. I'll post my notes here when I am done and update the Atlassian issue.

    They should do this more like a wiki.

    13 Dec 2012
  6. User avatar


    This page is very amusing... but I guess it still serves a purpose as the people who make decisions usually don't read past the summary page of anything.

    thumbs up to your sales team on this one.

    18 Apr 2013
  7. User avatar


    Please get this fleshed out!

    30 Apr 2013
  8. User avatar


    Please create the doc

    26 Jun 2013
  9. User avatar


    Use Jenkins instead. A page on how to set up and get started is here:

    25 Jul 2013
  10. User avatar


    Please Atlassian !

    03 Sep 2013
  11. User avatar


    Please. I refuse to pay for this service until PHP is documented.

    09 Sep 2013
  12. User avatar

    Mary Slocum

    Is PHPUnit 4.3.4 supported? In setting up a PHPUnit tasks (PHPUnit 3.3.X or just PHPUnit) is only has the option to send report to XML, but for PHPUnit --log-xml is an unrecognized option.

    28 Feb 2015
  13. User avatar

    Ismo Baradji


    After testing, I got thir error:

    Error summary for Buid, Unit Test, artifacts

    The job generated some errors, drill down into the full build log for more details.

    Could not find test result reports in the /opt/atlassian/bamboo-home/xml-data/build-dir/PMCTIR-PMP-BUTA directory.

    28 Apr 2015
  14. User avatar

    Phill Pafford

    Please add the steps to create the artifacts that PHPUnit produces

    30 Jul 2015
Powered by Confluence and Scroll Viewport