SDK for PHP to access leanIX REST API

Installs: 8

Dependents: 0

Suggesters: 0

Stars: 0

Watchers: 9

Forks: 0

Open Issues: 0

2.0.12 2016-01-03 08:40 UTC


leanIX API version v1, https://developer.leanix.net


This SDK contains wrapper code used to call the leanIX REST API from PHP.

The SDK also contains two simple examples. The code in samples/ServicesTest.php demonstrates the basic use of the SDK to read Applications from the leanIX Inventory. The code in samples/ProjectsTest.php demonstrates the basic use of the SDK for Projects in leanIX.


This SDK makes use of PHP namespaces, and as such requires PHP 5.3 or later. Please head to http://www.php.net to download the latest version.

In order to use the code in this SDK, the REST API needs to be activated in your workspace and you need your personal API Key. When you are logged in to leanIX, please go to your profile (click on the user icon in the top menu). You find a menu entry called "API / 3rd party apps". If the REST API is activated, you can generate an API Key here.

You can find the leanIX REST API documentation here https://developer.leanix.net. The documentation is interactive - if you are logged in to your workspace and the REST API is activated, you can try out every function directly from the documentation.

Installing SDK using Composer

Using Composer is one of the options to install LeanIX SDK for PHP.

  1. Add "leanix/leanix-sdk-php" as a dependency in your project's composer.json file.

        "require": {
            "leanix/leanix-sdk-php": "2.0.*"
  2. Download and install Composer.

    curl -s "http://getcomposer.org/installer" | php

  3. Install your dependencies.

    php composer.phar install

  4. Require Composer's autoloader by adding the following line to your code's bootstrap process.

    require '/path/to/sdk/vendor/autoload.php';


In order to use the SDK in your PHP application, you can use the autoloader which automatically loads required classes from the leanIX SDK.


You need to instantiate a leanIX API Client. Here you define the URL to the REST API of your workspace. Please replace demo with the name of your workspace. Also here you need to provide the Api-Key.

$apiClient = new LeanIX\Api\ApiClient();
$apiClient->basePath = "https://app.leanix.net/demo/api/v1";
$apiClient->apiKey = "31c7cfa0b5cb755f4c7f146c92d0ad6b";

You can then use the API class to execute functions. For each Fact Sheet in leanIX there is one API class, e.g. for the Fact Sheet "Application" the API class is called ServicesApi. To print the names of all applications which match the full-text search of "design", you could do the following:

$servicesApi = new LeanIX\Api\ServicesApi($apiClient);
$services = $servicesApi->getServices(false, "design");
foreach ($services as $service)
    echo $service->name."\r\n";

Update SDK

Go into folder codegen and execute

mvn package

Thank You

This API made use of the swagger-* libraries which help you to describe REST APIs in an elegant way. See here for more details: https://github.com/wordnik/swagger-codegen

Copyright and license

Copyright 2015 LeanIX GmbH under the MIT license.