{"id":21806380,"url":"https://github.com/svilborg/wiremock","last_synced_at":"2026-04-05T23:03:22.672Z","repository":{"id":213823785,"uuid":"735013328","full_name":"svilborg/wiremock","owner":"svilborg","description":"WireMock Playground","archived":false,"fork":false,"pushed_at":"2023-12-23T11:33:24.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-27T22:46:27.965Z","etag":null,"topics":["mock","php","wiremock"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/svilborg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-12-23T11:00:27.000Z","updated_at":"2023-12-23T15:49:34.000Z","dependencies_parsed_at":"2023-12-23T12:56:38.431Z","dependency_job_id":null,"html_url":"https://github.com/svilborg/wiremock","commit_stats":null,"previous_names":["svilborg/wiremock"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/svilborg/wiremock","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svilborg%2Fwiremock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svilborg%2Fwiremock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svilborg%2Fwiremock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svilborg%2Fwiremock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/svilborg","download_url":"https://codeload.github.com/svilborg/wiremock/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svilborg%2Fwiremock/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31452901,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T21:22:52.476Z","status":"ssl_error","status_checked_at":"2026-04-05T21:22:51.943Z","response_time":75,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["mock","php","wiremock"],"created_at":"2024-11-27T12:19:17.264Z","updated_at":"2026-04-05T23:03:22.628Z","avatar_url":"https://github.com/svilborg.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"## WireMock\n\n[WireMock](https://wiremock.org/docs/overview/) is a open-source tool for API mock testing.\n\n### Install\n\n`docker compose up wiremock`\n\nWireMock is available on `http://0.0.0.0:8888/__admin/mappings/`\n\n### Running the Experiments\n\n`docker compose -f ./docker-compose.yml exec wiremockapp bash`\n\n`php ./src/sample.php`\n\nUses `wiremock-php/wiremock-php` to control/record WireMock Server trough the `__admin` API.\n\n### Pros/Cons\n\n**Pros**\n\n- Centralized mocks storage on local/test/beta for any 3rd party API or internal ones - ocular, for example\n- WireMock Admin API to record mocks; Record Snapshots - using WireMock as proxy for recording\n- Supports mocks in json format (WireMock mappings)\n- Supports delays - static/random, etc.\n- Supports errors - empty/malformed data/closed connection\n- Uses http://handlebarsjs.com/ for templates/variables\n- Request Headers/Params can be used to inject dynamic content/values\n- Support for JSON/Graphql/XML/SOAP\n- Keeps info about all received requests/ missed matches for debugging\n- Library with mocks - https://library.wiremock.org/\n\n**Cons**\n\n- Another tool\n- Another docker dependency\n- If used cross project - another repo / supporting mappings\n- It is not very easy to work with `wiremock-php` - no documentation, but it is a fork of the java one\n- Needs reset after manually editing a mock (`curl -X POST http://0.0.0.0:8888/__admin/mappings/reset`)\n- No free official UI, cloud version only, there are some unofficial ones\n- No free IntelliJ/PHPStorm plugin; Free plugin for Visual Studio Code but I cant quite work with it\n- JSON responses (usually) inside JSON mapping - not easy\n\n### Examples\n\n##### Recording mocks / mappings\n\n[Recording](./src/record/recording.php)\n\n[Snapshot](./src/record/snapshot_post.php)\n\n##### Exact Url matching\n\n```php\nGET http://0.0.0.0:8888/123\n```\n\n```http request\n\nHTTP/1.1 200 OK\nContent-Type: application/json; charset=utf-8\nDate: Sat, 14 Oct 2023 10:52:34 GMT\nMatched-Stub-Id: 8b830f63-9592-49c5-940b-2033b55f8ccd\nMatched-Stub-Name: 123\n\n{\n\"message\": \"Sample by URL\",\n\"status\": \"ok\"\n}\n```\n\n##### Pattern Url matching\n\n```php\nGET http://0.0.0.0:8888/sample/abc\n```\n\n```http request\n\nHTTP/1.1 200 OK\nContent-Type: application/json; charset=utf-8\nMatched-Stub-Id: 8b830f63-9592-49c5-940b-2033b55f8888\nMatched-Stub-Name: sample-match\n\n{\n    \"message\": \"Sample by URL Pattern\",\n    \"status\": \"ok\"\n}\n```\n\n##### Variables in response - random alphanumeric\n\n```php\nGET http://0.0.0.0:8888/random\n```\n\n```http request\nHTTP/1.1 200 OK\nContent-Type: application/json; charset=utf-8\nDate: Sat, 14 Oct 2023 10:52:34 GMT\nMatched-Stub-Id: 8b830f63-9592-49c5-940b-2033b55f1111\nMatched-Stub-Name: sample-random\n\n{\n    \"created\": 1697552476,\n    \"message\": \"Sample random string: h0hcobts1yghuvibpkk9rctrlyg7x8a67\",\n    \"status\": \"ok\"\n}\n\n```\n\n##### Handlebars templates\n\n```php\nGET http://0.0.0.0:8888/param?id=123\n```\n\n```http request\nHTTP/1.1 200 OK\nContent-Type: application/json; charset=utf-8\n\n{\n\"message\": \"Called with: 123 \",\n\"number\": \"YES\"\n}\n```\n\n```php\nGET http://0.0.0.0:8888/param?id=abc\n```\n\n```http request\nHTTP/1.1 200 OK\nContent-Type: application/json; charset=utf-8\n\n{\n\"message\": \"Called with: abc \",\n\"number\": \"NO\"\n}\n```\n\n##### No Match\n\n```php\nGET http://0.0.0.0:8888/none\n```\n\n```http request\n\nHTTP/1.1 404 Not Found\nContent-Type: text/plain;charset=UTF-8\n\n                                               Request was not matched\n                                               =======================\n\n-----------------------------------------------------------------------------------------------------------------------\n| Closest stub                                             | Request                                                  |\n-----------------------------------------------------------------------------------------------------------------------\n                                                           |\nGet models                                                 |\n                                                           |\nGET                                                        | GET\n[path template] /v1/models                                 | /none                        \u003c\u003c\u003c\u003c\u003c URL does not match\n                                                           |\n-----------------------------------------------------------------------------------------------------------------------\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsvilborg%2Fwiremock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsvilborg%2Fwiremock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsvilborg%2Fwiremock/lists"}