dev-master
9999999-dev https://github.com/jenkins-khan/jenkins-php-apiJenkins PHP API
MIT
The Development Requires
by jenkins-khan
api jenkins
Jenkins PHP API
Jenkins PHP API is a set of classes designed to interact with Jenkins CI using its API., (*1)
The recommended way to install Jenkins PHP API is through Composer., (*2)
curl -sS https://getcomposer.org/installer | php
Then, run the Composer command to install the latest version:, (*3)
composer.phar require jenkins-khan/jenkins-api
Before anything, you need to instantiate the client :, (*4)
$jenkins = new \JenkinsKhan\Jenkins('http://host.org:8080');
If your Jenkins needs authentication, you need to pass a URL like this : 'http://user:token@host.org:8080'
., (*5)
Here are some examples of how to use it:, (*6)
$job = $jenkins->getJob("dev2-pull"); var_dump($job->getColor()); //string(4) "blue"
$job = $jenkins->launchJob("clone-deploy"); var_dump($job); // bool(true) if successful or throws a RuntimeException
$view = $jenkins->getView('madb_deploy'); foreach ($view->getJobs() as $job) { var_dump($job->getName()); } //string(13) "altlinux-pull" //string(8) "dev-pull" //string(9) "dev2-pull" //string(11) "fedora-pull"
$job = $jenkins->getJob('dev2-pull'); foreach ($job->getBuilds() as $build) { var_dump($build->getNumber()); var_dump($build->getResult()); } //int(122) //string(7) "SUCCESS" //int(121) //string(7) "FAILURE"
var_dump($jenkins->isAvailable()); //bool(true);
For more information, see the Jenkins API., (*7)
This projects follows PSR-0, PSR-1, PSR-2, PSR-4, (*8)
Jenkins PHP API
MIT
api jenkins