Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Artax Laravel Package

amphp/artax

Deprecated (unmaintained) async HTTP/1.1 client for PHP built on Amp. Implements HTTP over raw TCP sockets (no ext/curl), with keep-alive pooling, redirects, gzip decoding, streaming bodies, TLS, cookies, and proxy support. Use amphp/http-client instead.

View on GitHub
Deep Wiki
Context7

title: Parallel Requests permalink: /parallel description: Artax allows making multiple requests in parallel. It leverages non-blocking I/O like all other Amp libraries for that.

Artax allows making multiple requests in parallel. It leverages non-blocking I/O like all oth er Amp libraries for that. Instead of sending one request, waiting for the response, then doing something different like sending another request, we can use the time we're usually waiting for the server to respond to send a second request to another (or the same) server.

{:.table-no-border .table-full-width .table-text-center} | ![sequential requests]({{ site.baseurl }}/images/requests-sequential.svg)Sequential Requests | ![parallel requests]({{ site.baseurl }}/images/requests-parallel.svg)Parallel Requests |

As you can see in the sequence diagrams, we save some time there. We only have to wait for the maximum response delay of both requests instead of the sum of both. With more requests this speedup is even more interesting.

<?php

$client = new Amp\Artax\DefaultClient;
$promises = [];

foreach ($urls as $url) {
    $promises[$url] = Amp\call(function () use ($client, $url) {
        // "yield" inside a coroutine awaits the resolution of the promise
        // returned from Client::request(). The generator is then continued.
        $response = yield $client->request($url);

        // Same for the body here. Yielding an Amp\ByteStream\Message
        // buffers the entire message.
        $body = yield $response->getBody();

        return $body;
    });
}

$responses = Amp\Promise\wait(Amp\Promise\all($promises));
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
besmartand-pro/php-quality-config
sentix/ai-chatbot
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity