PHP code example of chrgriffin / laravel-defer

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

    

chrgriffin / laravel-defer example snippets


ChrGriffin\LaravelDefer\LaravelDeferServiceProvider

'LaravelDefer' => ChrGriffin\LaravelDefer\Facades\LaravelDefer::class

@deferJS

// or:

echo ChrGriffin\LaravelDefer\LaravelDefer::js();

return [
    'function_name'    => 'bananas',
    'with_script_tags' => false
];

LaravelDefer::setFunctionName('bananas');
LaravelDefer::setWithScriptTags(false);

'ignored_paths' => [
    '/resources/views/mail', // this will skip all Blade templates inside the mail folder
    '/resources/views/nope.blade.php' // this will skip this specific template
],

'ignored_images' => [
    'https://i.warosu.org/data/vr/img/0021/46/1420008946756.jpg', // this will skip this particular image
    'https://i.warosu.org/', // this will skip all images from this URL
    '1420008946756.jpg' // this will skip any image with this filename
],

php artisan vendor:publish

php artisan view:clear