{"id":29270682,"url":"https://github.com/kirouane/imposter","last_synced_at":"2025-10-12T17:14:19.136Z","repository":{"id":57006976,"uuid":"149276780","full_name":"Kirouane/imposter","owner":"Kirouane","description":"Mock HTTP requests with php ","archived":false,"fork":false,"pushed_at":"2020-03-22T22:41:32.000Z","size":240,"stargazers_count":5,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-12T17:14:18.757Z","etag":null,"topics":["api","http","mock","php","phpunit","stub"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kirouane.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-18T11:24:18.000Z","updated_at":"2022-08-23T13:10:07.000Z","dependencies_parsed_at":"2022-08-21T14:31:03.043Z","dependency_job_id":null,"html_url":"https://github.com/Kirouane/imposter","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/Kirouane/imposter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kirouane%2Fimposter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kirouane%2Fimposter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kirouane%2Fimposter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kirouane%2Fimposter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kirouane","download_url":"https://codeload.github.com/Kirouane/imposter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kirouane%2Fimposter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279012188,"owners_count":26085078,"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-10-12T02:00:06.719Z","response_time":53,"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","http","mock","php","phpunit","stub"],"created_at":"2025-07-04T23:01:12.175Z","updated_at":"2025-10-12T17:14:19.131Z","avatar_url":"https://github.com/Kirouane.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Travis](https://travis-ci.com/Kirouane/imposter.svg?branch=master)](https://travis-ci.com/Kirouane/imposter.svg?branch=master)\n[![Coverage Status](https://coveralls.io/repos/github/Kirouane/imposter/badge.svg)](https://coveralls.io/github/Kirouane/imposter?branch=master)\n\nImposter\n======\n\nImposter is a php library that used to serve http stubs and mocks.\n\nHere is an example to emphasize how is simple to mock an HTTP endpoint with this library in PHPUnit.\n\n```php\n\nnamespace Imposter;\n\nuse PHPUnit\\Framework\\TestCase;\n\n/**\n * Class ScenarioTest\n * @package Imposter\n */\nclass ReadMeTest extends TestCase\n{\n    /**\n     * @test\n     *\n     */\n    public function match()\n    {\n        ImposterFactory::get()-\u003emock(8081)\n            -\u003ewithPath('/users/1')\n            -\u003ewithMethod('POST')\n            -\u003ereturnBody('{\"response\" :\"okay\"}')\n            -\u003eonce()\n            -\u003esend();\n\n        $client   = new \\GuzzleHttp\\Client();\n        $response = $client-\u003epost('http://localhost:8081/users/1')-\u003egetBody()-\u003egetContents();\n        self::assertSame($response, '{\"response\" :\"okay\"}');\n    }\n\n    public function tearDown()\n    {\n        ImposterFactory::get()-\u003eclose();\n    }\n}\n\n```\n\nInstall\n==\n\n`composer require kirouane/imposter --dev`\n\nFeatures\n==\n\n## Display logs\n\nIn case of the HTTP request doesn't match any mock, you can find out the reason here [http://localhost:2424/mock/log/html](http://localhost:2424/mock/log/html)\n\nBelow, you can see what the logs page looks like.\n\n![Logs](doc/log.png) \n\n## PHPUnit Asserter\n\nImposter Library uses PHPunit asserters to match HTTP requests with the mocks you create.\n\nExample :\n\n```php\nnamespace Imposter;\n\nuse PHPUnit\\Framework\\TestCase;\n\n/**\n * Class ScenarioTest\n * @package Imposter\n */\nclass ReadMeTest extends TestCase\n{\n    /**\n     * @test\n     */\n    public function match()\n    {\n        ImposterFactory::get()-\u003emock(8081)\n            -\u003ewithPath('/users/1')\n            -\u003ewithMethod(new RegularExpression('/POST|PUT/'))\n            -\u003ereturnBody('{\"response\" :\"okay\"}')\n            -\u003etwice()\n            -\u003esend();\n\n        $client   = new \\GuzzleHttp\\Client();\n        $response = $client-\u003epost('http://localhost:8081/users/1')-\u003egetBody()-\u003egetContents();\n        self::assertSame($response, '{\"response\" :\"okay\"}');\n\n        $response = $client-\u003eput('http://localhost:8081/users/1')-\u003egetBody()-\u003egetContents();\n        self::assertSame($response, '{\"response\" :\"okay\"}');\n    }\n\n    public function tearDown()\n    {\n        ImposterFactory::get()-\u003eclose();\n    }\n\n}\n```\n\n\n## Proxies\n\nNot implemented yet","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkirouane%2Fimposter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkirouane%2Fimposter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkirouane%2Fimposter/lists"}