{"id":26018984,"url":"https://github.com/moonwave99/moq","last_synced_at":"2026-04-25T03:04:28.143Z","repository":{"id":3525043,"uuid":"4584073","full_name":"moonwave99/moq","owner":"moonwave99","description":"the one-touch mock RESTful webserver.","archived":false,"fork":false,"pushed_at":"2013-07-26T17:21:18.000Z","size":136,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-08T00:09:15.997Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/moonwave99.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":"2012-06-07T10:44:04.000Z","updated_at":"2015-09-05T23:23:08.000Z","dependencies_parsed_at":"2022-08-19T22:32:23.806Z","dependency_job_id":null,"html_url":"https://github.com/moonwave99/moq","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moonwave99%2Fmoq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moonwave99%2Fmoq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moonwave99%2Fmoq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moonwave99%2Fmoq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moonwave99","download_url":"https://codeload.github.com/moonwave99/moq/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242163847,"owners_count":20082223,"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","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":[],"created_at":"2025-03-06T06:39:54.854Z","updated_at":"2026-04-25T03:04:23.089Z","avatar_url":"https://github.com/moonwave99.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"#moq - the one-touch mock RESTful webserver.\n\nYou need a webserver to test your client/mobile/whatever app right now.\nYou want it to understand HTTP methods and to return proper HTTP responses.\nYou want it to be setup in a minute, you want it bad.\n\nHere it is!\n\nYou just need a basic **Apache/PHP** environment to run it - even on a remote server.\n\nSee it in action [here](http://moonwave99.webfactional.com/moq/), or performing HTTP requests such as:\n\n\tGET\t\thttp://moonwave99.webfactional.com/moq/users\n\tPOST\thttp://moonwave99.webfactional.com/moq/users/17\n\nAll responses are not-cached and **JSON** formatted.\n\n##Installation and Configuration\n\nJust clone this repository into desired webserver path:\n\n\t$ git clone https://github.com/moonwave99/moq\n\nor unzip in same location if you prefer. Then look at ```index.php```:\n\n\t$moq = new Moq(\n\t\t'routes.yml'\t\t\t\t// replace this with desired routes file\n\t);\n\nand change the .yml file path if you want.\n\n##Usage\n\nPoint your browser / HTTP client at the path you entered before:\n\n\tGET http://localhost/moq\n\nYou should get this response:\n\n\t200 OK moq server working.\n\nThen look at ```routes.yml```, you'll see a list of demo URIs you may edit on purpose:\n\n\t-   url:        '/users'\n\t    method:     GET\n\t    delay:      1\n\t    responses:\n\t        200:    [\n\t                    { id: 1, firstName: 'foo', lastName: 'bar', username : 'foobar'},\n\t                    { id: 2, firstName: 'henry', lastName: 'chinaski', username : 'chinaski'}\n\t                ]\n\t        403:    Access denied baby.\n\n\t-   url:        '/users'\n\t    method:     POST\n\t    responses:\n\t        201:    null\n\t        400:    This is a bad request baby.\n\n\t-   url:        '/users/:id'\n\t    method:     GET\n\t    responses:\n\t        200:    { id: :id, firstName: 'foo', lastName: 'bar', username : 'foobar'}\n\n\t-   url:        '/users/:id'\n\t    method:     PUT\n\t    responses:\n\t        200:    { id: :id, firstName: 'bar', lastName: 'foo', username : 'foobar'}\n\n\t\t\t...\n\neach one composed of:\n\n* a **pattern**, which may contain *colon-placeholders* [ex. ```:id```];\n* a HTTP **method** [```GET```/```POST```/```PUT```/```DELETE```];\n* an optional **delay** the response should be shifted of, in seconds [0 if not given of course];\n* a list of HTTP **responses** based on HTTP **statuses**.\n\nSo if you ask the server for:\n\n\tGET /users\n\nYou should get:\n\n\t200 OK [{ id: 1, firstName: 'foo', lastName: 'bar', username : 'foobar'}]\n\nPlaceholders in routes may be used in response body too. Asking for:\n\n\tGET /users/17\n\ngives you:\n\n\t200 OK { id: 17, firstName: 'foo', lastName: 'bar', username : 'foobar'}\n\n---\n\nUsually you want to test the server for different behaviors, and being this a mock server you can't define business logic in order to replicate them. But you may ask **moq** for a specific status:\n\n\tGET /users?_status=403\n\nand you'll get associated response:\n\n\t403 Forbidden \"Access denied baby.\"\n\nIf no status parameter is given, first response from list is chosen of course.\n\n##Copyright and license\n\nCopyright (c) 2012 MWLabs\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n##Acknowledgements\n\nMany thanks to brilliant [spyc](http://code.google.com/p/spyc/) YAML parser library.\n\n##Author\n\n[www.diegocaponera.com](http://www.diegocaponera.com/) - Just another coder.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoonwave99%2Fmoq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoonwave99%2Fmoq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoonwave99%2Fmoq/lists"}