Skip to content

azulus/delayable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The PHP Delayable framework allows for delayed instantiation/retrieval of page content via proxy objects. Objects which implement the "Delayable" interface will have their method calls delayed until a render operation or blocking operation is called on them (a foreach or __toString call). Examples:

------------------------------------------------------

/**
CURL Example (example_curl.php):

curl providers built-in functions for running parallel http requests through it's PHP library. Using 
curl_multi_add_handle, curl_multi_exec, and curl_multi_getcontent, the developer can request multiple
urls from curl at the same time and retrieve the results at the speed of the slowest request (as
opposed to the speed of all requests combined). The \example\UrlLoader class abstracts this work out
in the loadDelayed method and the Delayable framework will run all the calls in parallel as soon as 
the results are needed (when the echo is called in this example).
**/

require("example_common.php");

$urlLoader = delay( new \example\UrlLoader() );
$google = $urlLoader->get("http://www.google.com");
$yahoo = $urlLoader->get("http://www.yahoo.com");
$bing = $urlLoader->get("http://www.bing.com");

echo $google.$yahoo.$bing;

About

PHP delayable / parallel loading library (prefetching without prefetching)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published