Download the PHP package ddelnano/dredd-hooks-php without Composer

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

PHP Hooks for Dredd API Testing Framework

Build Status [Packagist]() [Packagist]() [Packagist]() [license]()

About

This package contains a PHP Dredd hook handler which provides a bridge between the Dredd API Testing Framework and PHP environment to ease implementation of testing hooks provided by Dredd. Write Dredd hooks in PHP to glue together API Blueprint with your PHP project

Not sure what these Dredd Hooks are? Read the Dredd documentation on them

The following are a few examples of what hooks can be used for:

Example

Installing

Composer

Requirements

dredd-hooks-php can be easily installed through the use of Composer.

composer require ddelnano/dredd-hooks-php --dev

Usage

  1. Create a hook file in hooks.php

Very Important Please make sure the closure passed to any Dredd\Hooks method uses a reference for the $transaction variable!! This is necessary so that the $transaction variable does not need to be returned from the closure in order to persist changes to the variable in the closure's local scope.

  1. Run it with dredd

dredd apiary.apib localhost:3000 --language php --hookfiles ./hooks.php

API

The Dredd\Hooks class provides the following methods before, after, before_all, after_all, before_each, after_each, before_validation, and before_each_validation. These methods correspond to the events that Dredd will run as it makes requests to the API endpoints defined in the blueprint/apiary.apib file. The before, before_validation and after hooks are identified by transaction name

Wildcards

Must be using version 1.1 or higher

When writing hooks for different api endpoints its very common to need the same hook for similar endpoints. For instance when testing Admin features the request must be authenticated with a user that has admin privileges. For all hooks needing this instead of writing a hook for each one the following can be used.

This would execute for any transactions "nested" underneath 'Admin'. For example the following transaction names would execute the callback: 'Admin > Login', 'Admin > Test', etc.

How to Contribute

  1. Fork it
  2. Create your feature branch (git checkout -b my-newfeature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push (git push origin my-new-feature)
  5. Create a new Pull Request

Tests

When making a contribution it is very important to not break existing functionality. This project uses PHPUnit for unit testing and uses nodejs for Cucumber tests.

Dependencies

The test suite can be run by following these steps:

  1. Run the phpunit and Cucumber tests

More details about the integration test can be found in the dredd-hooks-template repo

Further Details

For examples and more information please visit the wiki


All versions of dredd-hooks-php with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
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 ddelnano/dredd-hooks-php contains the following files

Loading the files please wait ....