PHPackages                             cst/leantesting - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. cst/leantesting

ActiveLibrary[Testing &amp; Quality](/categories/testing)

cst/leantesting
===============

Lean Testing PHP SDK

v2.0.1(9y ago)22511MITPHPPHP &gt;=5.4

Since Nov 27Pushed 9y ago1 watchersCompare

[ Source](https://github.com/crowdsourcedtesting/leantesting-php)[ Packagist](https://packagist.org/packages/cst/leantesting)[ Docs](https://leantesting.com/)[ RSS](/packages/cst-leantesting/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (6)Dependencies (3)Versions (11)Used By (0)

Lean Testing PHP SDK
====================

[](#lean-testing-php-sdk)

[![Latest Stable Version](https://camo.githubusercontent.com/aa8affc9e33a6231c0c04afb51f7bedfc52d53ed37c47f08c3a5cba731b89bda/68747470733a2f2f706f7365722e707567782e6f72672f6373742f6c65616e74657374696e672f762f737461626c65)](https://packagist.org/packages/cst/leantesting)[![License](https://camo.githubusercontent.com/ddc67ed5bb216bb548b8336779965d796e38e2a6b36221a5fab2fc77b5f91da4/68747470733a2f2f706f7365722e707567782e6f72672f6373742f6c65616e74657374696e672f6c6963656e7365)](https://packagist.org/packages/cst/leantesting)

**PHP client for [Lean Testing](https://leantesting.com/) API**

You can sign up for a Lean Testing account at .

Requirements
------------

[](#requirements)

- PHP 5.4 or greater

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

[](#installation)

The library is installed via [Composer](http://getcomposer.org/). To install, simply add it to your `composer.json` file:

```
{
    "require": {
        "cst/leantesting": "2.*"
    }
}
```

And run composer to update your dependencies:

```
$ curl -s http://getcomposer.org/installer | php
$ php composer.phar update

```

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

[](#basic-usage)

- Instantiate the client

```
$client = new LeanTesting\API\Client\Client();
$client->attachToken('');

// Listing projects
$projects = $client->projects->all();

// Fetching project bugs
$bugs = $client->projects->find(123)->bugs->all();
```

Methods
-------

[](#methods)

- Get Current **Token**

```
$client->getCurrentToken()
```

- Attach New **Token**

```
$client->attachToken('');
```

- Generate **Authorization URL**

```
$generated_URL = $client->auth->generateAuthLink(
	'DHxaSvtpl91Xos4vb7d0GKkXRu0GJxd5Rdha2HHx', // client id
  'https://www.example.com/appurl/',
	'write', // scope
	'a3ahdh2iqhdasdasfdjahf26' // random string
);
print_r( $generated_URL );
```

- Exchange authorization code for an **access token**

```
$token = $client->auth->exchangeAuthCode(
	'DHxaSvtpl91Xos4vb7d0GKkXRu0GJxd5Rdha2asdasdx', // client id
	'DpOZxNbeL1arVbjUINoA9pOhgS8FNQsOkpE4CtXU', // client secret
	'authorization_code',
	'JKHanMA897A7KA9ajqmxly', // auth code
	'https://www.example.com/appurl/'
);
print_r( $token );
```

---

- Get **User** Information

```
$client->user->getInformation()
```

- Get **User** Organizations

```
$client->user->organizations->all()->toArray()
```

- Retrieve An Existing **User Organization**

```
$client->user->organizations->find(31)->data
```

---

- List All **Projects**

```
$client->projects->all()->toArray()
```

- Create A New **Project**

```
$new_project = $client->projects->create([
	'name' => 'Project135',
	'organization_id' => 5779
]);
print_r( $new_project->data );
```

- Retrieve An Existing **Project**

```
$client->projects->find(3515)->data
```

- List **Project Sections**

```
$client->projects->find(3515)->sections->all()->toArray()
```

- Adding A **Project Section**

```
$new_section = $client->projects->find(3515)->sections->create([
	'name' => 'SectionName'
]);
print_r( $new_section->data );
```

- List **Project Versions**

```
$client->projects->find(3515)->versions->all()->toArray()
```

- Adding A **Project Version**

```
$new_version = $client->projects->find(3515)->versions->create([
	'number' => 'v0.3.1104'
]);
print_r( $new_version->data );
```

- List **Project Test Cases**

```
$client->projects->find(3515)->testCases->all()->toArray();
```

- List **Project Test Runs**

```
$client->projects->find(3515)->testRuns->all()->toArray();
```

- Retrieve Results For **Test Run**

```
$client->projects->find(3515)->testRuns->find(123)->data;
```

- List **Project Users**

```
$client->projects->find(3515)->users->all()->toArray();
```

- Remove A **Project User**

```
$client->projects->find(3515)->users->delete(123);
```

- List **Bug Type Scheme**

```
$client->projects->find(3515)->bugTypeScheme->all()->toArray()
```

- List **Bug Status Scheme**

```
$client->projects->find(3515)->bugStatusScheme->all()->toArray()
```

- List **Bug Severity Scheme**

```
$client->projects->find(3515)->bugSeverityScheme->all()->toArray()
```

- List **Bug Reproducibility Scheme**

```
$client->projects->find(3515)->bugReproducibilityScheme->all()->toArray()
```

---

- List All **Bugs** In A Project

```
$client->projects->find(3515)->bugs->all()->toArray()
```

- Create A New **Bug**

```
$new_bug = $client->projects->find(3515)->bugs->create([
	'title' => 'Something bad happened...',
	'status_id' => 1,
	'severity_id' => 2,
	'project_version_id' => 123
]);
print_r( $new_bug->data );
```

- Retrieve Existing **Bug**

```
$client->bugs->find(123)->data
```

- Update A **Bug**

```
$updated_bug = $client->bugs->update(123, [
	'title' => 'Updated title',
	'status_id' => 1,
	'severity_id' => 2,
	'project_version_id' => 123
]);
print_r( $updated_bug->data );
```

- Delete A **Bug**

```
$client->bugs->delete(123)
```

---

- List Bug **Comments**

```
$client->bugs->find(123)->comments->all()->toArray()
```

---

- List Bug **Attachments**

```
$client->bugs->find(123)->attachments->all()->toArray()
```

- Upload An **Attachment**

```
$file_path = '/place/Downloads/Images/1370240743_2294218.jpg';
$new_attachment = $client->bugs->find(123)->attachments->upload($file_path);
print_r( $new_attachment->data )
```

- Retrieve An Existing **Attachment**

```
$client->attachments->find(21515)->data
```

- Delete An **Attachment**

```
$client->attachments->delete(75198)
```

---

- List **Platform Types**

```
$client->platform->types->all()->toArray()
```

- Retrieve **Platform Type**

```
$client->platform->types->find(1)->data
```

- List **Platform Devices**

```
$client->platform->types->find(1)->devices->all()->toArray()
```

- Retrieve Existing **Device**

```
$client->platform->devices->find(11)->data
```

- List **OS**

```
$client->platform->os->all()->toArray()
```

- Retrieve Existing **OS**

```
$client->platform->os->find(1)->data
```

- List **OS Versions**

```
$client->platform->os->find(1)->versions->all()->toArray()
```

- List **Browsers**

```
$client->platform->browsers->all()->toArray()
```

- Retrieve Existing **Browser**

```
$client->platform->browsers->find(1)->data
```

- List **Browser Versions**

```
$client->platform->browsers->find(1)->versions->all()->toArray()
```

---

- Using **Filters**

```
$client->projects->find(3515)->bugs->all(['limit' => 2, 'page' => 5]).toArray();
```

- **Entity List** Functions

```
$browsers = $client->platform->browsers->all()
echo $browsers->total()
echo $browsers->totalPages()
echo $browsers->count()
echo $browsers->toArray()
```

- **Entity List** Iterator When used in foreach() loops, entity lists will automatically rewind, regardless of `page` filter. After ending the loop, the entity list will **NOT** revert to first page or the initial instancing `page` filter setting in order not to cause useless API request calls.

```
$comments = $client->bugs->find(123)->comments->all(['limit' => 1]);
foreach ($comments as $page) {
	print_r( $page );
}
```

- **Entity List** Manual Iteration

```
$comments = $client->bugs->find(123)->comments->all(['limit' => 1]);
echo $comments->toArray();

// Will return false if unable to move forwards
$comments->next();      echo $comments->toArray();

// Will return false if already on last page
$comments->last();      echo $comments->toArray();

// Will return false if unable to move backwards
$comments->previous();  echo $comments->toArray();

// Will return false if already on first page
$comments->first();     echo $comments->toArray();
```

Security
--------

[](#security)

Need to report a security vulnerability? Send us an email to  or go directly to our security bug bounty site .

Development
-----------

[](#development)

Install dependencies:

```
composer install
```

Tests
-----

[](#tests)

Install dependencies as mentioned above (which will resolve [PHPUnit](http://packagist.org/packages/phpunit/phpunit)), then you can run the test suite:

```
./vendor/bin/phpunit
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/crowdsourcedtesting/leantesting-php/blob/master/CONTRIBUTING.md) for details.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity64

Established project with proven stability

 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 ~64 days

Recently: every ~41 days

Total

8

Last Release

3367d ago

Major Versions

v1.3.1 → v2.02017-02-20

### Community

Maintainers

![](https://www.gravatar.com/avatar/189c65f16774e3104e4ac78a46bee697737c46c5eaba35736951192b822fdcb7?d=identicon)[crowdsourcedtesting](/maintainers/crowdsourcedtesting)

![](https://www.gravatar.com/avatar/5242c4fe463ecde48116a7b033562d3ad6718c97fedeb66d996ad22ec2b32def?d=identicon)[cyakimov](/maintainers/cyakimov)

---

Top Contributors

[![cyakimov](https://avatars.githubusercontent.com/u/232124?v=4)](https://github.com/cyakimov "cyakimov (6 commits)")[![kirov117](https://avatars.githubusercontent.com/u/12052619?v=4)](https://github.com/kirov117 "kirov117 (6 commits)")[![todoconk](https://avatars.githubusercontent.com/u/2256091?v=4)](https://github.com/todoconk "todoconk (6 commits)")

---

Tags

api-clientbug-trackertestingapibug tracker

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/cst-leantesting/health.svg)

```
[![Health](https://phpackages.com/badges/cst-leantesting/health.svg)](https://phpackages.com/packages/cst-leantesting)
```

###  Alternatives

[davidhsianturi/laravel-compass

An elegant REST assistent for the Laravel framework.

1.3k84.5k](/packages/davidhsianturi-laravel-compass)[imbo/behat-api-extension

API extension for Behat

1082.5M9](/packages/imbo-behat-api-extension)

PHPackages © 2026

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