This is a mock server for PHPacto library.
Generate fake responses for your API and microservices from PHPacto Contracts collection (Example).
DISCLAIMER: PHPacto library is actually under heavy development. The code can be subject to any changes without BC until the release version
1.0.0
. Please use the issue tracker to report any enhancements or issues you encounter.
First of all clone this repository git clone git@github.com:phpacto/mock-server.git
and install vendors with composer composer install
.
export CONTRACTS_DIR='where-are/your-contracts/stored'
php -S 0.0.0.0:8000 bin/server_mock.php
SUGGESTION: Can use phpdotenv to load environment variables from file.
You can use this server mock to provide mocked responses to your clients.
docker run -it --rm \
-v $PWD/contracts:/srv/data \
-e CONTRACTS_DIR=data \
-p 8000:8000 \
phpacto/mock-server \
server_mock
If there are not any Contracts matching your request, the server cannot generate a response, then a special response with status code 418
will be returned.