{"id":33993825,"url":"https://github.com/crowdsourcedtesting/leantesting-php","last_synced_at":"2025-12-13T07:32:13.581Z","repository":{"id":56959860,"uuid":"46996921","full_name":"crowdsourcedtesting/leantesting-php","owner":"crowdsourcedtesting","description":"Lean Testing PHP SDK","archived":false,"fork":false,"pushed_at":"2017-02-23T21:02:16.000Z","size":376,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-05T04:18:35.078Z","etag":null,"topics":["api-client","bug-tracker"],"latest_commit_sha":null,"homepage":"https://leantesting.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/crowdsourcedtesting.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-27T19:48:45.000Z","updated_at":"2018-01-30T00:42:43.000Z","dependencies_parsed_at":"2022-08-21T09:51:03.453Z","dependency_job_id":null,"html_url":"https://github.com/crowdsourcedtesting/leantesting-php","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/crowdsourcedtesting/leantesting-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crowdsourcedtesting%2Fleantesting-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crowdsourcedtesting%2Fleantesting-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crowdsourcedtesting%2Fleantesting-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crowdsourcedtesting%2Fleantesting-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crowdsourcedtesting","download_url":"https://codeload.github.com/crowdsourcedtesting/leantesting-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crowdsourcedtesting%2Fleantesting-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27702030,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-13T02:00:09.769Z","response_time":147,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-client","bug-tracker"],"created_at":"2025-12-13T07:32:12.830Z","updated_at":"2025-12-13T07:32:13.576Z","avatar_url":"https://github.com/crowdsourcedtesting.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Lean Testing PHP SDK\n\n[![Latest Stable Version](https://poser.pugx.org/cst/leantesting/v/stable)](https://packagist.org/packages/cst/leantesting)\n[![License](https://poser.pugx.org/cst/leantesting/license)](https://packagist.org/packages/cst/leantesting)\n\n**PHP client for [Lean Testing](https://leantesting.com/) API**\n\nYou can sign up for a Lean Testing account at [https://leantesting.com](https://leantesting.com).\n\n## Requirements\n\n* PHP 5.4 or greater\n\n## Installation\n\nThe library is installed via [Composer](http://getcomposer.org/). To install, simply add it\nto your `composer.json` file:\n\n```json\n{\n    \"require\": {\n        \"cst/leantesting\": \"2.*\"\n    }\n}\n```\n\nAnd run composer to update your dependencies:\n\n    $ curl -s http://getcomposer.org/installer | php\n    $ php composer.phar update\n\n## Basic Usage\n\n- Instantiate the client\n```php\n$client = new LeanTesting\\API\\Client\\Client();\n$client-\u003eattachToken('\u003cyour token\u003e');\n\n// Listing projects\n$projects = $client-\u003eprojects-\u003eall();\n\n// Fetching project bugs\n$bugs = $client-\u003eprojects-\u003efind(123)-\u003ebugs-\u003eall();\n```\n\n## Methods\n\n- Get Current **Token**\n```php\n$client-\u003egetCurrentToken()\n```\n\n- Attach New **Token**\n```php\n$client-\u003eattachToken('\u003ctoken\u003e');\n```\n\n- Generate **Authorization URL**\n```php\n$generated_URL = $client-\u003eauth-\u003egenerateAuthLink(\n\t'DHxaSvtpl91Xos4vb7d0GKkXRu0GJxd5Rdha2HHx', // client id\n  'https://www.example.com/appurl/',\n\t'write', // scope\n\t'a3ahdh2iqhdasdasfdjahf26' // random string\n);\nprint_r( $generated_URL );\n```\n\n- Exchange authorization code for an **access token**\n```php\n$token = $client-\u003eauth-\u003eexchangeAuthCode(\n\t'DHxaSvtpl91Xos4vb7d0GKkXRu0GJxd5Rdha2asdasdx', // client id\n\t'DpOZxNbeL1arVbjUINoA9pOhgS8FNQsOkpE4CtXU', // client secret\n\t'authorization_code',\n\t'JKHanMA897A7KA9ajqmxly', // auth code\n\t'https://www.example.com/appurl/'\n);\nprint_r( $token );\n```\n\n----\n\n- Get **User** Information\n```php\n$client-\u003euser-\u003egetInformation()\n```\n\n- Get **User** Organizations\n```php\n$client-\u003euser-\u003eorganizations-\u003eall()-\u003etoArray()\n```\n\n- Retrieve An Existing **User Organization**\n```php\n$client-\u003euser-\u003eorganizations-\u003efind(31)-\u003edata\n```\n----\n\n- List All **Projects**\n```php\n$client-\u003eprojects-\u003eall()-\u003etoArray()\n```\n\n- Create A New **Project**\n```php\n$new_project = $client-\u003eprojects-\u003ecreate([\n\t'name' =\u003e 'Project135',\n\t'organization_id' =\u003e 5779\n]);\nprint_r( $new_project-\u003edata );\n```\n\n- Retrieve An Existing **Project**\n```php\n$client-\u003eprojects-\u003efind(3515)-\u003edata\n```\n\n\n- List **Project Sections**\n```php\n$client-\u003eprojects-\u003efind(3515)-\u003esections-\u003eall()-\u003etoArray()\n```\n\n- Adding A **Project Section**\n```php\n$new_section = $client-\u003eprojects-\u003efind(3515)-\u003esections-\u003ecreate([\n\t'name' =\u003e 'SectionName'\n]);\nprint_r( $new_section-\u003edata );\n```\n\n\n- List **Project Versions**\n```php\n$client-\u003eprojects-\u003efind(3515)-\u003eversions-\u003eall()-\u003etoArray()\n```\n\n- Adding A **Project Version**\n```php\n$new_version = $client-\u003eprojects-\u003efind(3515)-\u003eversions-\u003ecreate([\n\t'number' =\u003e 'v0.3.1104'\n]);\nprint_r( $new_version-\u003edata );\n```\n\n- List **Project Test Cases**\n\n```php\n$client-\u003eprojects-\u003efind(3515)-\u003etestCases-\u003eall()-\u003etoArray();\n```\n\n- List **Project Test Runs**\n\n```php\n$client-\u003eprojects-\u003efind(3515)-\u003etestRuns-\u003eall()-\u003etoArray();\n```\n\n- Retrieve Results For **Test Run**\n```php\n$client-\u003eprojects-\u003efind(3515)-\u003etestRuns-\u003efind(123)-\u003edata;\n```\n\n- List **Project Users**\n```php\n$client-\u003eprojects-\u003efind(3515)-\u003eusers-\u003eall()-\u003etoArray();\n```\n\n- Remove A **Project User**\n```php\n$client-\u003eprojects-\u003efind(3515)-\u003eusers-\u003edelete(123);\n```\n\n- List **Bug Type Scheme**\n```php\n$client-\u003eprojects-\u003efind(3515)-\u003ebugTypeScheme-\u003eall()-\u003etoArray()\n```\n\n- List **Bug Status Scheme**\n```php\n$client-\u003eprojects-\u003efind(3515)-\u003ebugStatusScheme-\u003eall()-\u003etoArray()\n```\n\n- List **Bug Severity Scheme**\n```php\n$client-\u003eprojects-\u003efind(3515)-\u003ebugSeverityScheme-\u003eall()-\u003etoArray()\n```\n\n- List **Bug Reproducibility Scheme**\n```php\n$client-\u003eprojects-\u003efind(3515)-\u003ebugReproducibilityScheme-\u003eall()-\u003etoArray()\n```\n\n----\n\n- List All **Bugs** In A Project\n```php\n$client-\u003eprojects-\u003efind(3515)-\u003ebugs-\u003eall()-\u003etoArray()\n```\n\n- Create A New **Bug**\n```php\n$new_bug = $client-\u003eprojects-\u003efind(3515)-\u003ebugs-\u003ecreate([\n\t'title' =\u003e 'Something bad happened...',\n\t'status_id' =\u003e 1,\n\t'severity_id' =\u003e 2,\n\t'project_version_id' =\u003e 123\n]);\nprint_r( $new_bug-\u003edata );\n```\n\n- Retrieve Existing **Bug**\n```php\n$client-\u003ebugs-\u003efind(123)-\u003edata\n```\n\n- Update A **Bug**\n```php\n$updated_bug = $client-\u003ebugs-\u003eupdate(123, [\n\t'title' =\u003e 'Updated title',\n\t'status_id' =\u003e 1,\n\t'severity_id' =\u003e 2,\n\t'project_version_id' =\u003e 123\n]);\nprint_r( $updated_bug-\u003edata );\n```\n\n- Delete A **Bug**\n```php\n$client-\u003ebugs-\u003edelete(123)\n```\n\n----\n\n- List Bug **Comments**\n```php\n$client-\u003ebugs-\u003efind(123)-\u003ecomments-\u003eall()-\u003etoArray()\n```\n\n----\n\n- List Bug **Attachments**\n```php\n$client-\u003ebugs-\u003efind(123)-\u003eattachments-\u003eall()-\u003etoArray()\n```\n\n- Upload An **Attachment**\n```php\n$file_path = '/place/Downloads/Images/1370240743_2294218.jpg';\n$new_attachment = $client-\u003ebugs-\u003efind(123)-\u003eattachments-\u003eupload($file_path);\nprint_r( $new_attachment-\u003edata )\n```\n\n- Retrieve An Existing **Attachment**\n```php\n$client-\u003eattachments-\u003efind(21515)-\u003edata\n```\n\n- Delete An **Attachment**\n```php\n$client-\u003eattachments-\u003edelete(75198)\n```\n\n----\n\n- List **Platform Types**\n```php\n$client-\u003eplatform-\u003etypes-\u003eall()-\u003etoArray()\n```\n\n- Retrieve **Platform Type**\n```php\n$client-\u003eplatform-\u003etypes-\u003efind(1)-\u003edata\n```\n\n\n- List **Platform Devices**\n```php\n$client-\u003eplatform-\u003etypes-\u003efind(1)-\u003edevices-\u003eall()-\u003etoArray()\n```\n\n- Retrieve Existing **Device**\n```php\n$client-\u003eplatform-\u003edevices-\u003efind(11)-\u003edata\n```\n\n\n- List **OS**\n```php\n$client-\u003eplatform-\u003eos-\u003eall()-\u003etoArray()\n```\n\n- Retrieve Existing **OS**\n```php\n$client-\u003eplatform-\u003eos-\u003efind(1)-\u003edata\n```\n\n- List **OS Versions**\n```php\n$client-\u003eplatform-\u003eos-\u003efind(1)-\u003eversions-\u003eall()-\u003etoArray()\n```\n\n\n- List **Browsers**\n```php\n$client-\u003eplatform-\u003ebrowsers-\u003eall()-\u003etoArray()\n```\n\n- Retrieve Existing **Browser**\n```php\n$client-\u003eplatform-\u003ebrowsers-\u003efind(1)-\u003edata\n```\n\n- List **Browser Versions**\n```php\n$client-\u003eplatform-\u003ebrowsers-\u003efind(1)-\u003eversions-\u003eall()-\u003etoArray()\n```\n\n----\n\n- Using **Filters**\n```php\n$client-\u003eprojects-\u003efind(3515)-\u003ebugs-\u003eall(['limit' =\u003e 2, 'page' =\u003e 5]).toArray();\n```\n\n- **Entity List** Functions\n```php\n$browsers = $client-\u003eplatform-\u003ebrowsers-\u003eall()\necho $browsers-\u003etotal()\necho $browsers-\u003etotalPages()\necho $browsers-\u003ecount()\necho $browsers-\u003etoArray()\n```\n\n- **Entity List** Iterator\nWhen used in foreach() loops, entity lists will automatically rewind, regardless of `page` filter.\nAfter 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.\n```php\n$comments = $client-\u003ebugs-\u003efind(123)-\u003ecomments-\u003eall(['limit' =\u003e 1]);\nforeach ($comments as $page) {\n\tprint_r( $page );\n}\n```\n\n- **Entity List** Manual Iteration\n```php\n$comments = $client-\u003ebugs-\u003efind(123)-\u003ecomments-\u003eall(['limit' =\u003e 1]);\necho $comments-\u003etoArray();\n\n// Will return false if unable to move forwards\n$comments-\u003enext();      echo $comments-\u003etoArray();\n\n// Will return false if already on last page\n$comments-\u003elast();      echo $comments-\u003etoArray();\n\n// Will return false if unable to move backwards\n$comments-\u003eprevious();  echo $comments-\u003etoArray();\n\n// Will return false if already on first page\n$comments-\u003efirst();     echo $comments-\u003etoArray();\n```\n\n\n## Security\n\nNeed to report a security vulnerability? Send us an email to support@crowdsourcedtesting.com or go directly to our security bug bounty site [https://hackerone.com/leantesting](https://hackerone.com/leantesting).\n\n## Development\n\nInstall dependencies:\n\n``` bash\ncomposer install\n```\n\n## Tests\n\nInstall dependencies as mentioned above (which will resolve [PHPUnit](http://packagist.org/packages/phpunit/phpunit)), then you can run the test suite:\n\n```bash\n./vendor/bin/phpunit\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](https://github.com/crowdsourcedtesting/leantesting-php/blob/master/CONTRIBUTING.md) for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrowdsourcedtesting%2Fleantesting-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrowdsourcedtesting%2Fleantesting-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrowdsourcedtesting%2Fleantesting-php/lists"}