Http2Pusher
1.0.0
PHP HTTP2 서버 푸셔
HTTP/2 PUSH를 사용하면 웹 서버가 브라우저가 요청하기 전에 웹 브라우저로 리소스를 보낼 수 있습니다. 대부분의 경우 일부 웹 사이트가 더 빨리로드하는 데 도움이되는 성능 기술입니다. - 위키 백과
CloudFlare의 이미지
작곡가 사용 : composer require melbahja/http2-pusher
인스턴스 얻기 :
require ' vendore/autoload.php ' ;
use Melbahja Http2 Pusher ;
$ pusher = Pusher:: getInstance ();예 :
// set css file
$ pusher -> link ( ' /assets/css/style.css ' );
// set css and image and src
$ pusher -> link ( ' /asstes/css/main.css ' )
-> src ( ' /assets/js/scripts.js ' )
-> img ( ' /assets/img/logo.png ' )
- set (Pusher:: IMG , ' /assets/img/logo2.png ' );
// set link with options
$ pusher -> link ( ' https://fonts.gstatic.com ' , [
' as ' => false ,
' rel ' => ' preconnect '
]);
// rel by default is preload
// as by default is the link type
// push header
$ pusher -> push (); Pusher::getInstance(): PusherInterface
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 저작권 (C) 2017 Mohamed Elbahja