medicorenl / bamboo-api-bundle
Bamboo REST API integration in Symfony2
Installs: 69
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 6
Forks: 1
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.3.2
- guzzle/guzzle: 3.5.*
- symfony/framework-bundle: >=2.2.0,<3.0-dev
This package is not auto-updated.
Last update: 2024-04-22 11:54:55 UTC
README
A Symfony2 bundle that integrates the Bamboo REST API into native Symfony2 services.
Installation
-
Install Composer.
# Install Composer curl -sS https://getcomposer.org/installer | php
-
Add this bundle to the
composer.json
file of your project.# Add BambooApiBundle as a dependency php composer.phar require medicorenl/jira-api-bundle dev-master
-
After installing, you need to require Composer's autloader in the bootstrap of your project.
// app/autoload.php $loader = require __DIR__ . '/../vendor/autoload.php';
-
Add the bundle to your application kernel.
// app/AppKernel.php public function registerBundles() { return array( // ... new BambooApiBundle\BambooApiBundle(), // ... ); }
-
Configure the bundle by adding parameters to the
config.yml
file:# app/config/config.yml bamboo_api.url: "http://bamboo.your-organisation.com/rest/api/latest/" bamboo_api.credentials: "username:password"
Usage
This bundle contains a number of services, to access them through the service container:
// Get the BambooApiBundle\Service\BuildService $buildService = $this->get('bamboo_api.build'); $buildService->getLatestResults($options); // Get the BambooApiBundle\Service\ProjectService $planService = $this->get('bamboo_api.project'); $planService->getAllPlans($options);
You can also add them to the service container of your own bundle:
<!-- src/Project/Bundle/Resources/config/services.xml --> <?xml version="1.0" encoding="UTF-8"?> <container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services$ <services> <service id="myproject.myservice" class="MyProject\MyBundle\Services\MyService.php" public="true"> <argument type="service" id="bamboo_api.build" /> <argument type="service" id="bamboo_api.plan" /> </service> </services> </container>
You can then use them in your own services
<?php namespace Project\Bundle\Services; use BambooApiBundle\Service\BuildService; use BambooApiBundle\Service\PlanService; /** * Service class for my bundle. */ class MyService { /** * @var \BambooApiBundle\Service\BuildService */ private $buildService; /** * @var \BambooApiBundle\Service\PlanService */ private $planService; /** * Constructor. * * @param \BambooApiBundle\Service\BuildService $buildService * @param \BambooApiBundle\Service\PlanService $planService */ public function __construct( BuildService $buildService, PlanService $planService, ) { $this->buildService = $buildService; $this->planService = $planService; } }
Unit testing
BambooApiBundle uses PHP Unit for unit testing.
-
Download PHP Unit.
# Download PHP Unit wget http://pear.phpunit.de/get/phpunit.phar chmod +x phpunit.phar
-
Make sure all dependencies are installed through Composer.
# Install dependencies php composer.phar install
-
Run the unit tests.
# Run unit tests php phpunit.phar