PHP code example of melbahja / http2-pusher
1. Go to this page and download the library: Download melbahja/http2-pusher library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
melbahja / http2-pusher example snippets
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();