https://github.com/lav45/mock-server
HTTP mocking application for testing and fast prototyping
https://github.com/lav45/mock-server
api mock rest-api testing
Last synced: 10 months ago
JSON representation
HTTP mocking application for testing and fast prototyping
- Host: GitHub
- URL: https://github.com/lav45/mock-server
- Owner: lav45
- Created: 2023-02-10T11:49:53.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2025-08-31T20:44:35.000Z (10 months ago)
- Last Synced: 2025-08-31T22:20:39.393Z (10 months ago)
- Topics: api, mock, rest-api, testing
- Language: PHP
- Homepage:
- Size: 621 KB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Mock Server
HTTP mocking application for testing and fast prototyping
[](https://hub.docker.com/r/lav45/mock-server)
[](https://hub.docker.com/r/lav45/mock-server)
[](https://hub.docker.com/r/lav45/mock-server)
[](https://codecov.io/gh/lav45/mock-server)
[Docker image](https://hub.docker.com/r/lav45/mock-server)
## Features
- [Env](docs/env.md) - Storage of variables that can be used in the Response and WebHooks
- [Server environment](docs/env.md#server-environment) - Server environment
- [Faker](docs/env.md#faker) - Generate random data
- [Request](docs/request.md)
- [Routing](docs/request.md#requesturl)
- [Response](docs/response.md)
- [Content](docs/response/content.md)
- [Delay](docs/response/content.md#responsedelay)
- [Faker](docs/response/content.md#faker) - Generate random data
- [Request parameters](docs/response/content.md#request-parameters) - You can get data from your request and use it in the response
- [Proxy](docs/response/proxy.md)
- [Data provider](docs/response/data.md)
- [WebHooks](docs/webhooks.md)
- [Faker](docs/webhooks.md#faker) - Generate random data
- **Auto reload mock file without restarting the server**
## Quick start
Create mock file `./mocks/index.json` and put the content in it
```json
[
{
"request": {
"method": "GET",
"url": "/"
},
"response": {
"type": "content",
"text": "Hello world!"
}
}
]
```
### Run the Mock Server
```shell
docker run --rm -it -v $(pwd)/mocks:/app/mocks -p 8080:8080 lav45/mock-server:latest
```
### Checking
```shell
curl http://127.0.0.1:8080/
```
### Upgrade mocks data
```shell
docker run --rm -it -v $(pwd)/mocks:/app/mocks -e MOCKS_PATH=/app/mocks lav45/mock-server:latest upgrade
```
## Build containers
```shell
./build.sh
```
## Run in development mode
```shell
docker run --rm -it -v $(pwd):/app -p 8080:8080 -e DEBUG=1 mock-server:server
```
## Testing
```shell
./composer test
```