Download the PHP package draw/http-tester without Composer

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

Php Http Tester

This library is meant to be a testing framework for http call. It is framework agnostic. By default it does a curl call to the specified url but you can use/create a adapter for the framework you are using.

The library can be install via Composer/Packagist.

In that example we are trying to have a browser flow so the usage of phpunit annotation @depends and @test make it more readable.

Here is a quick example of how to use it in a PHPUnit TestCase:

<?php

namespace Your\Project\Name;

use PHPUnit\Framework\TestCase;
use Draw\HttpTester\HttpTesterTrait;

class SimpleTest extends TestCase
{
    use HttpTesterTrait

    /**
     * @test
     */
    public function notAuthorizeProfileAccess()
    {
        static::$client->get('http://your.domain.com/api/me')
            ->assertStatus(403);
    }

    /**
     * @test
     * @depends notAuthorizeProfileAccess
     */
    public function login()
    {
        $testResponse = static::$client->post(
            'http://your.domain.com/api/tokens',
            json_encode([
                'username' => 'my-username',
                'password' => 'my-password'
            ])
        );

        $content = $testResponse
          ->assertSuccessful()
          ->assertCookie('session') // We are not debating the usage of cookie here ;)
          ->getResponseBodyContents();

        // Continue with the test of you content
        $this->assertJson($content);
    }

    /**
     * @test
     * @depends login
     */
    public function getMyProfile()
    {
        // The same client is during all test. Cookies are sent automatically between request
        $testResponse = static::$client->get('http://your.domain.com/api/me')

        $content = $testResponse
          ->assertSuccessful()
          ->getResponseBodyContents();

        // Continue with the test of you content
        $this->assertJson($content);
    }
}

If you need to use it in another context and can still relay on PHPUnit Assertion you can simply create your the client manually and use it:

<?php

use Draw\HttpTester\Client;

$client = new Client();

$client->post(
    'http://your.domain.com/api/tokens',
    json_encode([
        'username' => 'my-username',
        'password' => 'my-password'
    ])
);

By default the client will use the Draw\HttpTester\CurlRequestExecutioner but you can make your own by implementing the Draw\HttpTester\RequestExecutionerInterface.

## Currently Supported Request Executioner

ExecutionerClassPackage
Curl Laravel 4.2Draw\HttpTester\CurlRequestExecutioner Draw\HttpTester\Bridge\Laravel4\Laravel4RequestExecutionerdraw/http-tester draw/http-tester

Not available yet There is a lot more features available, just Read the Docs!


All versions of http-tester with dependencies

PHP Build Version
Package Version
Requires phpunit/phpunit Version ^7.0|^6.0|^5.7
guzzlehttp/psr7 Version ^1.4
pdeans/http Version ^1.1
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 draw/http-tester contains the following files

Loading the files please wait ....