PHPackages                             samjoyce777/lazy - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. samjoyce777/lazy

ActiveLaravel[Utility &amp; Helpers](/categories/utility)

samjoyce777/lazy
================

Replace the HTML::image standard into a lazy load on all images

041PHP

Since Feb 7Pushed 10y ago1 watchersCompare

[ Source](https://github.com/samjoyce777/lazy)[ Packagist](https://packagist.org/packages/samjoyce777/lazy)[ RSS](/packages/samjoyce777-lazy/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel 5 Lazy Image Loader
===========================

[](#laravel-5-lazy-image-loader)

This package changes the normal HTMLBuilder package image method to output the HTML that will be formatted in a way that can be lazy loaded.

### Installation

[](#installation)

```
$ composer install samjoyce777/lazy --save
```

In the config.php file you need to insert the service provider

```
$ \samjoyce777\lazy\LazyServiceProvider::class,
```

and then change the HTML facade to the new one, this class simply extends it so you have complete use of the other methods, it is only the image that has been overriden.

```
$ 'HTML' => samjoyce777\lazy\LazyFacade::class,
```

You will need to get the javascript file, this goes to the public directory at the moment. You will then need to include or concat it.

```
$ php artisan vendor:publish --tag=public --force
```

This will add the config file to your apps config.

```
$ php artisan vendor:publish --tag=config
```

Not been able to get the package routing to work properly, so copy this route into your routes file

```
$ \Route::get('ajax-lazy-image', ['as' => 'ajax-lazy-image', 'uses' => '\samjoyce777\lazy\ImageController@ajax']);
```

### Example Usage

[](#example-usage)

Normal HTML::image will now change the src tag to the default placeholder image in the config and then change with js

```
  {!!HTML::image('cushion.jpg', 'cushion picture')!!}
```

Some items you may want different placeholders such as products or avatars etc, if you set a class placeholder in the config it will load that placeholder image

```
  {!!HTML::image('cushion.jpg', 'cushion picture', ['class' => 'product'])!!}
```

If you need to override the placeholder for a one off, you can do by setting a placeholder attribute

```
  {!!HTML::image('cushion.jpg', 'cushion picture', ['class' => 'product', 'placeholder' => 'images/large-placeholder.png'])!!}
```

There are two types of lazy load which are set in the config. The 'basic' will simple change all the placeholder images with the intended image. Not sure how effective on load speed this is unless you have a lot of images. The 'ajax' method sends screen size and element size to the above route, where your controller can send an appropriate size image, in the ImageController included is an example using my Album package.

### This is still in work in progress stage.

[](#this-is-still-in-work-in-progress-stage)

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7439530?v=4)[elmhurst interactive](/maintainers/elmhurst)[@elmhurst](https://github.com/elmhurst)

---

Top Contributors

[![elmhurst50](https://avatars.githubusercontent.com/u/6770978?v=4)](https://github.com/elmhurst50 "elmhurst50 (6 commits)")

### Embed Badge

![Health badge](/badges/samjoyce777-lazy/health.svg)

```
[![Health](https://phpackages.com/badges/samjoyce777-lazy/health.svg)](https://phpackages.com/packages/samjoyce777-lazy)
```

###  Alternatives

[csharpru/vault-php

Best Vault client for PHP that you can find

8410.9M5](/packages/csharpru-vault-php)[maximaster/tools.finder

Библиотека, облегчающая поиск идентификаторов разных сущностей для 1С-Битрикс

108.2k](/packages/maximaster-toolsfinder)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
