Sign inSign up

phpacto/mock-server

By phpacto

•Updated almost 2 years ago

Contract testing solution for your applications

Image
0

3.0K

phpacto/mock-server repository overview

⁠PHPacto MockServer

This is a mock server for PHPacto⁠ library.

Generate fake responses for your API and microservices from PHPacto Contracts collection (Example⁠).

License Build Status CodeCov Scrutinizer Quality Score Codacy Quality Grade Latest Stable Version Total Downloads

Docker Build Status Docker Image Size Docker Pulls Docker Stars

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.

⁠Usage as standalone

First of all clone this repository git clone [email protected]: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.

⁠Usage with Docker

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.

Tag summary

Content type

Image

Digest

Size

41.7 MB

Last updated

over 5 years ago

docker pull phpacto/mock-server