Skip to content
Power up your app or SDK with a testing library specifically for Symfony/HttpClient
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

Full Documentation at

Charge up your app or SDK with a testing library specifically for Symfony/HttpClient.


composer require --dev --prefer-dist blastcloud/hybrid

Example Usage


use BlastCloud\Hybrid\{Expectation, UsesHybrid};
use Symfony\Component\HttpClient\Response\MockResponse;
use PHPUnit\Framework\TestCase;

class SomeTest extends TestCase
    use UsesHybrid;

    public $classToTest;

    public function setUp(): void
        $client = $this->hybrid->getClient([
            /* Any configs for a client */
            "base_uri" => ""
        // You can then inject this client object into your code or IOC container.
        $this->classToTest = new ClassToTest($client);

    public function testSomethingWithExpectations()
            ->withHeader("X-Authorization", "some-key")
            ->willRespond(new MockResponse("Some body"));

    public function testSomethingWithAssertions()
            new MockResponse(null, ['http_code' => 204]),
            new \Exception("Some message"),
            // any needed responses to return from the client.
        // ... Some other number of calls
        $this->hybrid->assertAll(function (Expectation $expect) {
            return $expect->withHeader("Authorization", "some-key");


Full Documentation


Hybrid is open-source software licensed under the MIT License.

You can’t perform that action at this time.