Download the PHP package chstudio/raven without Composer

On this page you can find all versions of the php package chstudio/raven. 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 raven

Raven - How to test your API documentation and behavior.

Scrutinizer Code Quality Code Coverage

Latest Stable Version License

This library was written to allow testing OpenAPI documentation easily. It also allows verifying that your code implementation is compatible with that documentation.

Why creating such tool ?

We work a lot on API related projects. Sometimes we create API, sometimes we consume them. The OpenAPI description format is now well known and used in a lot of different contexts.

Our concern is that it's hard to ensure that the written documentation is representing the current API behavior. We wanted to track the implementation difference between the doc and the code.

We searched the ecosystem and found that it exists different tools to mock APIs or to perform requests to them. However we can't find a tool that allows performing HTTP requests that use fixtures and are able to perform specific validation on the responses.

So we started working on Raven!

It relies on PSRs to be easily integrated in any project and is composed of two different parts:

Raven, isn't it a bird ?

Nope, we use here the human name of the X-Men character Mystique. She's able to transform and adapt to any situation which is that tool goal. We need to adapt to any API to trigger valid requests and analyze responses.

Install it

Using Composer:

To use Raven you might need to also install:

Of course you can also write your own. The only constraint is to be compatible with PSRs interfaces.

Usage

Execute Request / Response validation

This library defines its own interfaces for request validation. It comes with an adapter to the league/openapi-psr7-validator package which define a complete validation logic.

Generate requests easily based on configuration

Writing RequestInterface objects manually might not be the simplest way to define your test cases. We created a RequestFactory to help building those objects. It rely on PSR17 HTTP factories.

Here is an example which use the nyholm/psr7.

If the body is given as an array, it will be encoded based on the Content-Type header:

Enrich your request body with resolver

Most of the time having static request bodies will not be powerful enough. We need identifiers and other details extracted from our fixtures. A specific layer can be added around the RequestFactory to resolve body dynamically.

You can combine different Resolver and let the configured body pass through all the methods and be enriched. This library come with a specific Faker resolver to generate data easily with providers (see Faker doc).

You can build your own resolvers using the ValueResolverInterface.

Custom expectations

Validating that the request and the response are respecting the documentation is nice but we might need to add some user defined expectations. Will this request trigger a 401 response ? Is the body containing the correct value ?

Expectation can be built using request definition data. Based on some properties, they will be added dynamically. The expectation collection can be passed to the Executor::execute method.

If one of the expectation fails, the response validation will fail and you'll get the details through a ExpectationFailedException error.

This library come with built in expectations: StatusCode. You can easily build your own using the ResponseExpectationInterface.

License

This package is released under the Apache-2 license.

Contribute

If you wish to contribute to the project, please read the CONTRIBUTING notes.


All versions of raven with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1.0
league/openapi-psr7-validator Version 0.*
devizzent/cebe-php-openapi Version ^1.0
psr/http-message Version ^1.0
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/log Version ^1.0|^2.0|^3.0
fakerphp/faker Version ^1.20
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 chstudio/raven contains the following files

Loading the files please wait ....