PHP code example of tomkeyte / laravel-http2-push

1. Go to this page and download the library: Download tomkeyte/laravel-http2-push 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/ */

    

tomkeyte / laravel-http2-push example snippets


'cookie_expire_types' => [
    'font' => 90,
    'script' => 27,
    'style' => 24,
    'image' => 30,
],

'always' => [
    '/js/app.js', # A simple string
    [
        'src' => '/css/app.css', # Or an array, containing the src & expiry time
        'expires' => '90',
    ],
],

// use default cookie expiry lengths
@h2push('/css/app.css')

// specify a cookie expiry length of 60 days, for this resource only
@h2push('/js/app.js', 60)

@h2push( mix('/css/app.css') )
bash
php artisan vendor:publish --provider="TomKeyte\LaravelHttp2Push\Http2PushServiceProvider"