Coder Social home page Coder Social logo

Comments (4)

colinodell avatar colinodell commented on August 26, 2024

Guzzle has support for async requests if you'd rather use their library instead of building it yourself. (There might be other lighter libraries too, I'm just not familiar with any.)

from magescan.

beejhuff avatar beejhuff commented on August 26, 2024

I've been checking out Guzzle recently to see if we could try and eliminate the use of curl in our own codebases where it makes sense, but hadn't found a small enough sample to dig in yet.

It looks like it would be a pretty solid alternative and also a simpler solution to stay native php as the syntax for streams looks pretty easy to grok first glance.

// Send an asynchronous request.
$request = new \GuzzleHttp\Psr7\Request('GET', 'http://httpbin.org');
$promise = $client->sendAsync($request)->then(function ($response) {
    echo 'I completed! ' . $response;
});
$promise->wait();

There do seem to be some minor requirements to address depending on which route you want to go. None are deal breakers for me, but before i start digging into this do any of these limitations matter or do were you thinking you might prefer curl as the first attempt?


Requirements

 * PHP 5.5.0
 * To use the PHP stream handler, allow_url_fopen must be enabled in your system's php.ini.
 * To use the cURL handler, you must have a recent version of cURL >= 7.19.4 compiled with OpenSSL and zlib.
 * Note : Guzzle no longer requires cURL in order to send HTTP requests. Guzzle will use the PHP stream wrapper to send HTTP requests if cURL is not installed. Alternatively, you can provide your own HTTP handler used to send requests.

from magescan.

steverobbins avatar steverobbins commented on August 26, 2024

Given that PHP 5.4 only has a couple month until EOL I'm okay with dropping it's support. All the other requirements are reasonable.

from magescan.

steverobbins avatar steverobbins commented on August 26, 2024

This has been added in version 1.12.0

from magescan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.