2017 © Pedro Peláez
 

library http2-pusher

PHP Http2 Server Pusher

image

melbahja/http2-pusher

PHP Http2 Server Pusher

  • Saturday, October 21, 2017
  • by melbahja
  • Repository
  • 3 Watchers
  • 15 Stars
  • 954 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 2 Versions
  • 475 % Grown

The README.md

Http2Pusher

PHP Http2 Server Pusher, (*1)

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, (*2)

http2 image by cloudflare, (*3)

Installation :

using composer: composer require melbahja/http2-pusher, (*4)

Usage :

get the instance:, (*5)


require 'vendore/autoload.php'; use Melbahja\Http2\Pusher; $pusher = Pusher::getInstance();

examples:, (*6)


// 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();

Public methods :

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

License :

MIT Copyright (c) 2017 Mohamed Elbahja, (*7)

The Versions

21/10 2017

dev-master

9999999-dev

PHP Http2 Server Pusher

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

http php7 pusher http2 php71

21/10 2017

v1.0

1.0.0.0

PHP Http2 Server Pusher

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

http php7 pusher http2 php71