PHPackages                             thusithawijethunga/jenkins-laravel-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. thusithawijethunga/jenkins-laravel-api

ActivePackage[API Development](/categories/api)

thusithawijethunga/jenkins-laravel-api
======================================

Jenkins Laravel API

1.0.1(3y ago)115MITPHPPHP ^7.1|^8.0

Since Oct 3Pushed 3y agoCompare

[ Source](https://github.com/thusithawijethunga/jenkins-laravel-api)[ Packagist](https://packagist.org/packages/thusithawijethunga/jenkins-laravel-api)[ Docs](https://github.com/thusithawijethunga/jenkins-laravel-api)[ RSS](/packages/thusithawijethunga-jenkins-laravel-api/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

Jenkins Larave API
==================

[](#jenkins-larave-api)

Jenkins Laravel API is a set of classes designed to interact with Jenkins CI using its API.

Installation
------------

[](#installation)

The recommended way to install Jenkins Laravel API is through [Composer](http://getcomposer.org).

```
curl -sS https://getcomposer.org/installer | php
```

Then, run the Composer command to install the latest version:

In bash terminal

```
composer.phar require thusithawijethunga/jenkins-laravel-api
```

In windows cmd terminal

```
composer require thusithawijethunga/jenkins-laravel-api
```

or Update your composer json

```
      "require": {
        ...,
        "thusithawijethunga/jenkins-laravel-api": "^1.0"
      }
```

Basic Usage
-----------

[](#basic-usage)

```
php artisan vendor:publish --tag=config
```

or

```
php artisan vendor:publish --provider="JenkinsLaravel\JenkinServiceProvider" --tag="config"
```

Before anything, you need to instantiate the client :

Update your Laravel Env File

```
# Url Is Https
JENKINS_URL_HTTPS   =   false
JENKINS_DOMAIN      =   host.org
JENKINS_PORT        =   8080
JENKINS_USER        =   admin
JENKINS_TOKEN       =   token
```

or update config file

```
\config\jenkinapi.php
```

```
    $jenkins = new \JenkinsLaravel\Jenkins();

```

If your Jenkins needs authentication, you need to pass a URL like this : `'http://user:token@host.org:8080'`.

Generate Api Token
------------------

[](#generate-api-token)

```
https://{jenkins}/user/{user-name}/configure
```

Here are some examples of how to use it:

Import Api Class
----------------

[](#import-api-class)

```
    use JenkinsLaravel\Jenkins as JenkinsApi;
```

Get the job information
-----------------------

[](#get-the-job-information)

```
    $jenkins = new JenkinsApi();

    $jenkins->initialize();

    $job = $jenkins->getJob("dev2-pull");

    $job->getName();

    $job->getFullDisplayName();

    $job->getColor();

    $job->getIsDisabled();

    $job->getNextBuildNumber();

    $job->getUrl();

    foreach ($job->getHealthReport() as $health) {

        $health->iconClassName;

        $health->description;

        $health->score;

    }

    $job->getColor(); // blue,red,notbuilt

    if($job->getQueueItem())
    {

        $job->getQueueItem()->getUrl();
        $job->getQueueItem()->getInQueueSince();
        $job->getQueueItem()->getWhy();

    }

    foreach ($job->getBuilds() as $build) {

        $build->getUrl();

    }

    if($job->getLastBuild())
    {

        $job->getLastBuild()->getUrl();
        $job->getLastBuild()->getNumber();

    }

    if($job->getLastCompletedBuild())
    {

        $job->getLastCompletedBuild()->getUrl();
        $job->getLastCompletedBuild()->getNumber();

    }

    if($job->getLastFailedBuild())
    {

        $job->getLastFailedBuild()->getUrl();
        $job->getLastFailedBuild()->getNumber();

    }

    if($job->getLastStableBuild())
    {

        $job->getLastStableBuild()->getUrl();
        $job->getLastStableBuild()->getNumber();

    }

    if($job->getLastSuccessfulBuild())
    {

        $job->getLastSuccessfulBuild()->getUrl();
        $job->getLastSuccessfulBuild()->getNumber();

    }

    if($job->getLastUnstableBuild())
    {

        $job->getLastUnstableBuild()->getUrl();
        $job->getLastUnstableBuild()->getNumber();

    }

    if($job->getLastUnsuccessfulBuild())
    {

        $job->getLastUnsuccessfulBuild()->getUrl();
        $job->getLastUnsuccessfulBuild()->getNumber();

    }

    // is Job Buildable?
    $job->getBuildable();
```

Get All Jobs
------------

[](#get-all-jobs)

```
$allJobs = $jenkins->getJobs();

foreach ($allJobs as $job) {
    # color
    $job->getColor()
    # name
    $job->getName()
    # url
    $job->getUrl()
}
```

Launch a Job
------------

[](#launch-a-job)

```
    $jenkins = new JenkinsApi();

    $jenkins->initialize();

    $job = $jenkins->launchJob("clone-deploy");
    var_dump($job);
    // bool(true) if successful or throws a RuntimeException
```

List the jobs of a given view
-----------------------------

[](#list-the-jobs-of-a-given-view)

```
    $jenkins = new JenkinsApi();

    $jenkins->initialize();

    $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"
```

Get All Views
-------------

[](#get-all-views)

```
$allViews = $jenkins->getViews();

foreach ($allViews as $view) {
    # name
    $job->getName()
    # url
    $job->getUrl()
}
```

List builds and their status
----------------------------

[](#list-builds-and-their-status)

```
    $jenkins = new JenkinsApi();

    $jenkins->initialize();

    $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"
```

Check if Jenkins is available
-----------------------------

[](#check-if-jenkins-is-available)

```
    var_dump($jenkins->isAvailable());
    //bool(true);
```

Get Jenkins Version
-------------------

[](#get-jenkins-version)

```
    var_dump($jenkins->getJenkinsVersion());
    //string(7) "2.361.1";
```

Using Facade
------------

[](#using-facade)

```
use JenkinsLaravel\Facade\Jenkin as JenkinsFacade;
```

```
# Call initialize function before calling each of other functions
JenkinsFacade::initialize();

$isAvailable = JenkinsFacade::isAvailable();

$jenkinsVersion = JenkinsFacade::getJenkinsVersion();

$allJobs = JenkinsFacade::getJobs();

$allViews = JenkinsFacade::getViews();
```

For more information, see the [Jenkins API](https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API).

Coding standards
----------------

[](#coding-standards)

This projects follows [PSR-0](https://www.php-fig.org/psr/psr-0/), [PSR-1](https://www.php-fig.org/psr/psr-1/), [PSR-2](https://www.php-fig.org/psr/psr-2/), [PSR-4](https://www.php-fig.org/psr/psr-4/)

TODO
----

[](#todo)

- createJob function need confirm

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

1317d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bb7fe3b4d36660c25181cafb53142dbbdaa460859042eacb8af21421525e53b0?d=identicon)[thusithawijethunga](/maintainers/thusithawijethunga)

---

Top Contributors

[![srogier](https://avatars.githubusercontent.com/u/814069?v=4)](https://github.com/srogier "srogier (39 commits)")[![agallou](https://avatars.githubusercontent.com/u/320372?v=4)](https://github.com/agallou "agallou (20 commits)")[![thusithawijethunga](https://avatars.githubusercontent.com/u/5456955?v=4)](https://github.com/thusithawijethunga "thusithawijethunga (20 commits)")[![nickdaugherty](https://avatars.githubusercontent.com/u/1103700?v=4)](https://github.com/nickdaugherty "nickdaugherty (10 commits)")[![xeBuz](https://avatars.githubusercontent.com/u/662916?v=4)](https://github.com/xeBuz "xeBuz (3 commits)")[![s-larionov](https://avatars.githubusercontent.com/u/529261?v=4)](https://github.com/s-larionov "s-larionov (1 commits)")[![KuiKui](https://avatars.githubusercontent.com/u/748924?v=4)](https://github.com/KuiKui "KuiKui (1 commits)")[![ianfixes](https://avatars.githubusercontent.com/u/583459?v=4)](https://github.com/ianfixes "ianfixes (1 commits)")[![timcrider](https://avatars.githubusercontent.com/u/874528?v=4)](https://github.com/timcrider "timcrider (1 commits)")[![elliotwms](https://avatars.githubusercontent.com/u/4396779?v=4)](https://github.com/elliotwms "elliotwms (1 commits)")

---

Tags

apijenkins

### Embed Badge

![Health badge](/badges/thusithawijethunga-jenkins-laravel-api/health.svg)

```
[![Health](https://phpackages.com/badges/thusithawijethunga-jenkins-laravel-api/health.svg)](https://phpackages.com/packages/thusithawijethunga-jenkins-laravel-api)
```

###  Alternatives

[m165437/laravel-blueprint-docs

API Blueprint Renderer for Laravel

22779.0k](/packages/m165437-laravel-blueprint-docs)[carlosio/jenkins

Jenkins API

2520.3k](/packages/carlosio-jenkins)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
