|Last Updated|| ||Ratings|| ||Unique User Downloads|| ||Download Rankings|
|2017-12-06 (1 year ago) || 64%||Total: 374 ||All time: 6,616 This week: 279|
This class can push Web resources using HTTP 2 requests.
It can send HTTP response headers to the browser to list resources that the page needs so the browser can pull those resources even before the whole Web page is loaded using parallel HTTP/2 requests.
|HTTP/2 is a newer version of the HTTP protocol that can make sites much faster by serving many of the resources a page needs by delivering them simultaneously to the user browser.
This class makes it easier to use HTTP/2 server push feature to take advantage of the speed gains when serving a PHP Web site page when it is running on a HTTP/2 server.
PHP Http2 Server Pusher
About Http2 Server Push :
> HTTP/2 Push allows a web server to send resources to a web browser before the browser gets to request them. It is, for the most part, a performance technique that can help some websites load faster. - wikipedia
image by cloudflare
`composer require melbahja/http2-pusher
get the instance:
$pusher = Pusher::getInstance();
// set css file
// set css and image and src
// set link with options
'as' => false,
'rel' => 'preconnect'
// rel by default is preload
// as by default is the link type
// push header
Public methods :
Pusher::link(string $link, array $opts = ): PusherInterface
Pusher::src(string $link, array $opts = ): PusherInterface
Pusher::img(string $link, array $opts = ): PusherInterface
Pusher::set(string $type, string $link, array $opts = ): PusherInterface
Pusher::getHeader(string $type = null): string
Pusher::push(string $type = null): void
Pusher::public function toHeader(string $type, array $urls): null|string
MIT Copyright (c) 2017 Mohamed Elbahja
||Applications that use this package
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.