Skip to content

Version v1.1.0 - Asynchronous Requests

Choose a tag to compare

@Sammyjo20 Sammyjo20 released this 24 Apr 18:01
· 102 commits to v1 since this release
af934a9

Introducing asynchronous request support for Saloon! There is now a new sendAsnc method on both the request and the connector and when used, it will return an instance of Guzzle Promise which you can then use in your application.

$request = new GetUserRequest(userId: 1);
$promise = $request->sendAsync();

$promise->then(
    function (SaloonResponse $response) {
        // Handle successful response...
    },
    function (SaloonRequestException $exception) {
        $response = $exception->getSaloonResponse();

        // Handle unsuccessful response...
    },
);