Download the PHP package mcustiel/phiremock-client without Composer

On this page you can find all versions of the php package mcustiel/phiremock-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package phiremock-client

Phiremock Client

Phiremock client provides a nice API to interact with Phiremock Server, allowing developers to setup expectations, clear state, scenarios etc. Through a fluent interface.

Packagist Version Build Status Scrutinizer Code Quality Packagist Downloads

Installation

Default installation through composer

This project is published in packagist, so you just need to add it as a dependency in your composer.json:

Phiremock Client requires guzzle client v6 to work. This dependency can be avoided and you can choose any psr18-compatible http client and overwrite Phiremock Client's factory to provide it.

Overwriting the factory class

If guzzle client v6 is provided as a dependency no extra configuration is needed. If you want to use a different http client you need to provide it to phiremock server as a psr18-compatible client. For instance, if you want to use guzzle client v7 you need to extend phiremock server's factory class:

Then use this factory class to create the Phiremock Client Facade.

Usage

Creating the Client Facade

Create the Client Facade by requesting it from the factory object:

Now you can use $phiremockClient to access all the configuration options of Phiremock Server.

Note: Phiremock will by default listen for http (unsecured) connections.

Connection to a secure server

If phiremock-server is listening for https connections. You can pass the scheme to use as a third argument:

Expectation creation

Also a cleaner/shorter way to create expectations is provided by using helper functions:

This code is equivalent to the one in the previous example.

You can see the list of shortcuts here: https://github.com/mcustiel/phiremock-client/blob/master/src/helper_functions.php

Listing created expectations

The listExpecatations method returns an array of instances of the Expectation class containing all the current expectations checked by Phiremock Server.

Clear all configured expectations

This will remove all expectations checked, causing Phiremock Server to return 404 for every non-phiremock-api request.

List requests received by Phiremock

Use this method to get a list of Psr-compatible Requests received by Phiremock Server.

Lists all requests:

Lists requests matching condition:

Note: Phiremock's API request are excluded from this list.

Count requests received by Phiremock

Provides an integer >= 0 representing the amount of requests received by Phiremock Server.

Count all requests:

Count requests matching condition:

Note: Phiremock's API request are excluded from this list.

Clear stored requests

This will clean the list of requests saved on Phiremock Server and resets the counter to 0.

Set Scenario State

Force a scenario to have certain state on Phiremock Server.

Reset Scenarios States

Reset all scenarios to the initial state (Scenario.START).

Reset all

Sets Phiremock Server to its initial state. This will cause Phiremock Server to:

  1. clear all expectations.
  2. clear the stored requests.
  3. reset all the scenarios.
  4. reload all expectations stored in files.

Appendix

See also:

Contributing:

Just submit a pull request. Don't forget to run tests and php-cs-fixer first and write documentation.

Thanks to:

And everyone who submitted their Pull Requests.


All versions of phiremock-client with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2|^8.0
ext-json Version *
mcustiel/phiremock-common Version ^1.0
psr/http-client Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mcustiel/phiremock-client contains the following files

Loading the files please wait ....