Skip to content

PHPacto/mock-server

Repository files navigation

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 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.

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published