PHPackages                             hmaus/spas - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. hmaus/spas

AbandonedArchivedLibrary[Testing &amp; Quality](/categories/testing)

hmaus/spas
==========

API end-to-end testing

v0.1.0-alpha2(9y ago)740MITPHPPHP &gt;=7.0

Since Nov 18Pushed 9y ago4 watchersCompare

[ Source](https://github.com/hendrikmaus/spas)[ Packagist](https://packagist.org/packages/hmaus/spas)[ RSS](/packages/hmaus-spas/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)Dependencies (22)Versions (3)Used By (0)

Spas
====

[](#spas)

That sounds like "spa", but plural.
It tests your API description against a given environment using real HTTP requests.

[![Minimum PHP Version](https://camo.githubusercontent.com/5c3072425e67297c8ef63d17acd2c86a0d2ef324f19249f2280bd7de902f63a2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230372e302d3838393242462e737667)](https://php.net/)[![Build Status](https://camo.githubusercontent.com/678cc47a23aa6c57f626ab60488c27b3cc7a01e017ea8d5230d4f5302ee512d2/68747470733a2f2f7472617669732d63692e6f72672f68656e6472696b6d6175732f737061732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/hendrikmaus/spas)[![Test Coverage](https://camo.githubusercontent.com/9f145612cfc4d44c48e72f1d33b1a04297774852f8f5bfe565caf9aa076f84a3/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f68656e6472696b6d6175732f737061732f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/hendrikmaus/spas/coverage)[![Code Climate](https://camo.githubusercontent.com/c8aea3e7ae4b903814d71f2dc35141c22eab35e3c6d298ca2034267e33d26d48/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f68656e6472696b6d6175732f737061732f6261646765732f6770612e737667)](https://codeclimate.com/github/hendrikmaus/spas)

Note
----

[](#note)

Spas is currently **alpha**, so its API is subject to change!

How It Works / Example
----------------------

[](#how-it-works--example)

There is a running example in the `example` dir including a readme to follow along.

In order to use spas, you'll need:

- your api description parser, e.g. drafter for api blueprint
- spas itself, which is api description agnostic
- spas-request-parser implementation, to understand your api description parse result

Running spas looks like:

- get parse result from your api description parser
- call spas with it

Installation
------------

[](#installation)

### From Source

[](#from-source)

The recommended way to install spas &amp; co is by using [composer](https://getcomposer.org).

#### API Description Parser

[](#api-description-parser)

In this example, we'll install [drafter](https://github.com/apiaryio/drafter) to work with API Blueprint.

```
composer require hmaus/drafter-installer
```

Now [configure the drafter installer](https://github.com/hendrikmaus/drafter-installer) accordingly. Make sure to actually install drafter, usually you'll add a script to call `composer install-drafter`during the config, and check it using `vendor/bin/drafter -v`.

#### Request Parser

[](#request-parser)

> Please see [a guide to create a request parser](https://github.com/hendrikmaus/spas-parser) if your parser is not yet supported

```
composer require hmaus/spas-parser-apib
```

This will get you `\Hmaus\Spas\Parser\Apib\ApibParsedRequestsProvider` to put into spas' `request_provider` option

#### Spas

[](#spas-1)

Now we can install spas itself:

```
composer require hmaus/spas
```

With a default composer config, spas should now be available as `vendor/bin/spas`.

Hooks
-----

[](#hooks)

The hook system is what makes spas pretty flexible. It allows you to add bits and pieces of code to manipulate requests, assert outcomes and much more.

There are a few pre-built hooks for you to examine and try out.
Simply browse `/src/Hook` to see pre-built hooks; all the ones prefixed with `Hello` are examples to learn from.

### Run Hook

[](#run-hook)

Take your spas command add an option:

```
--hook "Hmaus\Spas\Hook\HelloWorld"
```

As you can see, the hooks are simply passed using their fully qulified class name. So as long as the classes sit inside thee autloader, you can use them right away.

To pass multiple hooks, simply repeat the `--hook` option for every one of them.

```
--hook "Hmaus\Spas\Hook\HelloWorld"
--hook "Hmaus\Spas\Hook\HelloHookData"
```

### Pass Data to Hooks

[](#pass-data-to-hooks)

Many of your hooks shall be flexible in what they can do, hence you want to configure them from the outside.
We suggest to use JSON format to pass data into a hook like so:

```
--hook "Hmaus\Spas\Hook\HelloHookData"
--hook_data $'{
    "Hmaus-Spas-Hook-HelloHookData": {
        "apikey": "ewifvweilfvf"
    },
    "Your-Namespace-SomeOtherHook": {
        "hook-data-option": "contains all data passed to all hooks"
    }
}'
```

Note that you need to replace the backslashes with dashes for the `--hook_data`.
Let me know if you know how to make it work with the backslashes.

### Write Your Own Hooks

[](#write-your-own-hooks)

Once you examine the existing hooks, you should already gathered all there is to know.
Create a new class that is ato-loadable, extend `\Hmaus\Spas\Hook\Hook`, implement the one abstract method and check Hook's API and the pre-built examples for best practices.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~11 days

Total

2

Last Release

3454d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ed0b339a154b415594b6480f1a0ee0ac45fd395033123ea484cfe78f29f13dae?d=identicon)[hendrikmaus](/maintainers/hendrikmaus)

---

Top Contributors

[![hendrikmaus](https://avatars.githubusercontent.com/u/188284?v=4)](https://github.com/hendrikmaus "hendrikmaus (115 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hmaus-spas/health.svg)

```
[![Health](https://phpackages.com/badges/hmaus-spas/health.svg)](https://phpackages.com/packages/hmaus-spas)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19462.3M1.3k](/packages/drupal-core)[silverstripe/framework

The SilverStripe framework

7213.5M2.5k](/packages/silverstripe-framework)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
