Download the PHP package debjyotikar001/media-lazy-load without Composer

On this page you can find all versions of the php package debjyotikar001/media-lazy-load. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package media-lazy-load

Media Lazy Load for Laravel

A Laravel package to help users implement media lazy loading using PHP and JavaScript, optimizing page load speeds by only loading media when they are in view. It runs automatically when you load a view or page. Increase your website performance on page load and save bandwidth.

Key Features:

  1. Media (images, iframes, videos and audios) lazy loading for faster loading. Read More...
  2. Supports excluding specific routes urls paths from being media lazy loading. Read More...
  3. Configurable to skip lazy loading for specific application Environment. Read More...
  4. Easy integration with Laravel's middleware system. Read More...
  5. Supports lazy loading of background images set via inline CSS background-image:url(...).
  6. Customizable root margin allows you to control when elements start loading relative to their position in the viewport. Read More...
  7. Adjustable threshold defines how much of an element must be visible before it loads. Read More...

Installation

Media Lazy Load for Laravel requires PHP 7.4 or higher. This particular version supports Laravel 8.x, 9.x, 10.x, and 11.x.

To get the latest version, simply require the project using Composer:

Configuration

Media Lazy Load for Laravel supports optional configuration. To get started, you'll need to publish all vendor assets:

This will create a config/medialazyload.php file in your app that you can modify to set your configuration. Also, make sure you check for changes to the original config file in this package.

Register the Middleware

In order to add media lazy loading functionality in Laravel, you need to add the MedLazyLoad middleware.

(Laravel 10 or older)

In app/Http/Kernel.php file:

or

You can use the middleware class or middleware alias medialazyload in web middleware or route.

(Laravel 11 or newer)

In bootstrap/app.php file:

or

You can use the middleware class or middleware alias medialazyload in web middleware or route.

Usage

This is how you can use MediaLazyLoad for Laravel in your project.

Enable

You must set true on enabled in the config/medialazyload.php file enable media lazy loading functionality. For example:

Jquery for Lazy Loading

If you want to use Jquery to handle lazy loading, then set true on jquery and you can specify its CDN URL on jqueryUrl in the config/medialazyload.php file. For example:

Allowed Environments

If you want to disable it in specific environments such as during local development or testing to simplify debugging. Then set environments values in a comma (,) separated string in the config/medialazyload.php file, default local,production,staging. For example:

Skip or Ignore specific Routes Urls

If you want to skip or ignore specific routes urls, then you have to set paths in the config/medialazyload.php file. You can use '*' as wildcard. For example:

Example URLs:

Root Margin

This option allows you to control how early or late the elements should be lazy-loaded relative to their position in the viewport. You can set values in the config/medialazyload.php file, default '0px 0px 100px 0px'. Format: 'top right bottom left'. For example:

Here '0px 0px 100px 0px' means that elements will start loading 100px before they enter the viewport from the bottom. You can also use percentages (e.g., '10% 0px 0px 0px').

Threshold

This option allows you to control how much of an element must be visible in the viewport before it starts loading. It accepts a value between 0 and 1. You can set values in the config/medialazyload.php file, default 0.1. For example:

Here 0.1 means the element will start loading when 10% of it is visible in the viewport.

Example values:

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Contributions are welcome! Please see CONTRIBUTING for details on how to get started.

License

Media Lazy Load is licensed under the MIT license.

Support

If you are having general issues with this package, feel free to contact us on [email protected]


All versions of media-lazy-load with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
illuminate/support Version ^8.0|^9.0|^10.0|^11.0
illuminate/http Version ^8.0|^9.0|^10.0|^11.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package debjyotikar001/media-lazy-load contains the following files

Loading the files please wait ....