PHPackages                             aldeebhasan/lottie-laravel - 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. aldeebhasan/lottie-laravel

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

aldeebhasan/lottie-laravel
==========================

This package will allow you to manage and preview lottiefiles in your laravel project

1.1.0(2y ago)1017.5k↓33%1[2 issues](https://github.com/aldeebhasan/lottie-laravel/issues)MITPHPPHP &gt;=7.4

Since Oct 7Pushed 2y ago2 watchersCompare

[ Source](https://github.com/aldeebhasan/lottie-laravel)[ Packagist](https://packagist.org/packages/aldeebhasan/lottie-laravel)[ RSS](/packages/aldeebhasan-lottie-laravel/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

Laravel Lottie Library
======================

[](#laravel-lottie-library)

A php package allow you to load lottie files to your blade directly or after making some updates.

Installation
------------

[](#installation)

Install using composer:

```
composer require aldeebhasan/lottie-laravel:1.1.0
```

A new cache capabilities added to the package, you can enable it by using the following keys to your env file:

```
LOTTIE_CACHE=false
LOTTIE_CACHE_PERIOD=60

```

you can publish the config file using the following command:

```
php artisan vendor:publish --provider="Aldeebhasan\LottieLaravel\LottieLaravelServiceProvider" --tag="config"

```

Basic Usage
-----------

[](#basic-usage)

### Lottie file component

[](#lottie-file-component)

You can use the lottie file component directly within your blade as following

```

```

All the attributes are optional. Anyway, either `path` or `animationData` should be specified in order to display the lottie.

### Lottie files manager

[](#lottie-files-manager)

The package also provide a manager to manage the lottie files and make updates over them(like changing the colors)

**You can load the lottie file from remote url or pass the file content directly. Check the following**

```
use \Aldeebhasan\LottieLaravel\Facades\Lottie;
//from remote
$content = Lottie::loadUrl("https://example.json");
//from local array
$content = Lottie::loadData([
    "v" => "4.8.0",
    "meta" => [
         "g" => "LottieFiles AE 3.0.2",
         "a" => "",
         "k" => "",
         "d" => "",
         "tc" => ""
      ],
      ....
    ]);
```

After loading the lottie file to the manager you can change the colors using one of the following

```
$content = Lottie::loadUrl("https://example.json")
   ->replaceColor("#000","#0f0f0f") // color with color
   ->replaceColor(["#000","#00f"],"#fff") // color list with color
   ->replaceColor(["#000","#00f"],["#fff","#ff0"]); // color list with color list
```

The function `replaceColor` also accept `rgb` and `rgba` color encoding:

```
$content = Lottie::loadUrl("https://example.json")
   ->replaceColor("rgb(0,0,0)",'rgba(255,255,0)'); // color with color
```

To retrieve the updated lottie data you can use our `export` function:

```
$content = Lottie::loadUrl("https://example.json")
   ->replaceColor("rgb(0,0,0)",'rgba(255,255,0)')
   ->export();
```

Finally, thanks for the [lottie-web](https://github.com/airbnb/lottie-web) package author, without their lottie player, we were not able to complete this work.

**You can directly get an instance from the lottie manager using our helper function `lottie()`**

```
$content = lottie()->loadUrl("https://example.json");
```

### Direct Rendering

[](#direct-rendering)

now you can render the desired lottie file directly in your blade files. Only you need to provide the lottie file data or path, and you will get your view back.

```
//From  URL
{!! lottie()->loadUrl('https://assets8.lottiefiles.com/packages/lf20_tuzu65Bu6N.json')->render() !!}

//From Data
$data = lottie()->loadUrl('https://assets8.lottiefiles.com/packages/lf20_tuzu65Bu6N.json')->export();
{!! lottie()->loadData($data)->render() !!}
```

### Examples

[](#examples)

- Loading lottie file directly in the blade:

```

```

- Loading lottie file using the manager and pass it to the lottie component:

```
 @php($data = lottie()
            ->loadUrl('https://assets8.lottiefiles.com/packages/lf20_PmGV4skHBv.json')
            ->export())

@php($data2 = lottie()
            ->loadUrl('https://assets8.lottiefiles.com/packages/lf20_PmGV4skHBv.json')
            ->replaceColor(["#70D0EF","#B7B7B7","#FF5900"],["#F64848","#FFA900","#003BFF"])
            ->export())

```

[![](https://user-images.githubusercontent.com/62222392/194541107-37fb0f4f-0a34-42ab-a854-8811ebb5e24a.gif)](https://user-images.githubusercontent.com/62222392/194541107-37fb0f4f-0a34-42ab-a854-8811ebb5e24a.gif) | [![](https://user-images.githubusercontent.com/62222392/194541252-d89a9f29-e8be-4156-ba82-b44612442815.gif)](https://user-images.githubusercontent.com/62222392/194541252-d89a9f29-e8be-4156-ba82-b44612442815.gif)

License
-------

[](#license)

Laravel Lottie Library package is licensed under [The MIT License (MIT)](https://github.com/git/git-scm.com/blob/main/MIT-LICENSE.txt).

Security contact information
----------------------------

[](#security-contact-information)

To report a security vulnerability, contact directly to the developer contact email [Here](mailto:aldeeb.91@gmail.com).

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity48

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.

###  Release Activity

Cadence

Every ~285 days

Total

2

Last Release

1034d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/74e7b9d93b0f666f462ad0be43dde05991e9d141f9fe840009775808107d440e?d=identicon)[aldeebhasan](/maintainers/aldeebhasan)

---

Top Contributors

[![aldeebhasan](https://avatars.githubusercontent.com/u/62222392?v=4)](https://github.com/aldeebhasan "aldeebhasan (3 commits)")

---

Tags

laravellaravel-lottielottie-fileslottie-weblaravellottielottiefileslottiefiles manageerlottie preview

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/aldeebhasan-lottie-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/aldeebhasan-lottie-laravel/health.svg)](https://phpackages.com/packages/aldeebhasan-lottie-laravel)
```

###  Alternatives

[highideas/laravel-users-online

This package will provide an online users management.

203113.2k1](/packages/highideas-laravel-users-online)[stephenjude/filament-blog

Filament Blog Builder

20317.8k](/packages/stephenjude-filament-blog)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[datomatic/nova-detached-actions

A Laravel Nova tool to allow for placing actions in the Nova toolbar detached from the checkbox selection mechanism.

11229.2k](/packages/datomatic-nova-detached-actions)

PHPackages © 2026

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