PHP code example of justbetter / laravel-http3earlyhints

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

    

justbetter / laravel-http3earlyhints example snippets


// app/Http/Kernel.php

...
protected $middlewareGroups = [
    'web' => [
        ...
        \JustBetter\Http3EarlyHints\Middleware\AddHttp3EarlyHints::class,
        ...
    ],
    ...
];

// bootstrap/app.php

...
->withMiddleware(function (Middleware $middleware) {
    ...
    $middleware->appendToGroup('web', [
        \JustBetter\Http3EarlyHints\Middleware\AddHttp3EarlyHints::class,
    ]);
    // Or
    // $middleware->append(\JustBetter\Http3EarlyHints\Middleware\AddHttp3EarlyHints::class);
    ...
})
...

php artisan vendor:publish --provider="JustBetter\Http3EarlyHints\ServiceProvider"