Download the PHP package kielabokkie/jsonapi-behat-extension without Composer

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


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.

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?

All versions of jsonapi-behat-extension with dependencies

Informations about the package jsonapi-behat-extension

JSON API Behat Extension

Author Packagist Version Codacy Badge Gitter

The JSON API Behat Extension provides step definitions for common testing scenarios specific to JSON APIs. It comes with easy ways to handle authentication through OAuth.


Recommended installation is by running the composer require command. This will install the latest stable version of this extension.

composer require kielabokkie/jsonapi-behat-extension --dev


To use this extension you will have to add it under the extensions in your behat.yml file.

        Kielabokkie\BehatJsonApi: ~

Default parameters

Out of the box this extension has the following default parameters:

parameter value
base_url http://localhost:8000
oauth_uri /v1/oauth/token
oauth_client_id testclient
oauth_client_secret testsecret
oauth_use_bearer_token false
oauth_password_grant_requires_client_credentials false

You can overwrite any of these parameters in the behat.yml file as needed.

                    uri: /v1/oauth/token
                    client_id: myClientId
                    client_secret: myClientSecret
                    use_bearer_token: true
                    password_grant_requires_client_credentials: true

Optional parameters

To avoid having to use OAuth to retrieve an access token for each API call you can also specify an optional access_token in the parameters:

                access_token: 90dabed99acef998fd3e35280f2a0a3c30c00c8d


To use the step definitions provided by this extension just load the context class in your suites:

You will then have access to the following step definitions:

@Given I use the access token
@Given I use access token :token
@Given I oauth with :username and :password
@Given I oauth with :username and :password and scope :scope
@Given I oauth using the client credentials grant
@Given I oauth using the client credentials grant with scope :scope
@Given I oauth using the client credentials grant with :id and :secret
@Given I oauth using the client credentials grant with :id and :secret and scope :scope
@Given I add a :header header with the value :value
@Given I have the payload:
@When /^I request "(GET|PUT|PATCH|POST|DELETE) ([^"]*)"$/
@Then I get a :statuscode response
@Then scope into the :scope property
@Then scope into the first :scope element
@Then the structure matches:
@Then the :field property is an object
@Then the :field property is an array
@Then the :field property is an array with :count items
@Then the :field property is an empty array
@Then the :field property is an integer
@Then the :field property is a integer equaling/equalling :expected
@Then the :field property is a string
@Then the :field property is a string equaling/equalling :expected
@Then the :field property is a boolean
@Then the :field property is a boolean equaling/equalling :expected
@Then /^echo last request$/
@Then /^echo last response$

To get a list of all available step definitions including examples you can run the following command:

$ vendor/bin/behat -di

Override the base url

In some cases you might want to override the base url for a specific suite. Below is an example of a behat.yml file. Here the custom url is passed to the FeatureContext under the hooks suite.

        - %paths.base%/tests/Behat/features/bootstrap
                - %paths.base%/tests/Behat/features/api
                - Kielabokkie\BehatJsonApi\Context\JsonApiContext: ~
                - %paths.base%/tests/Behat/features/hooks
                - Kielabokkie\BehatJsonApi\Context\JsonApiContext:
        Kielabokkie\BehatJsonApi: ~

Requires php Version >=5.4
behat/behat Version ~3.0
kriswallsmith/buzz Version 0.15.2
phpunit/phpunit Version >=5.7

The package kielabokkie/jsonapi-behat-extension contains the following files

Loading the files please wait ....