PHPackages                             pyaesone17/s3-reducer - 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. pyaesone17/s3-reducer

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

pyaesone17/s3-reducer
=====================

Small and minimalist but effective Laravel library to reduce your s3 billing dramatically just by calling custom asset function.

1.0.0(8y ago)621MITPHPPHP ~5.6|~7.0

Since Mar 22Pushed 8y ago3 watchersCompare

[ Source](https://github.com/pyaesone17/s3-reducer)[ Packagist](https://packagist.org/packages/pyaesone17/s3-reducer)[ Docs](https://github.com/pyaesone17/s3-reducer)[ RSS](/packages/pyaesone17-s3-reducer/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (3)Versions (4)Used By (0)

S3Reducer
=========

[](#s3reducer)

Small ,minimalist but effective Laravel library to reduce your s3 billing dramatically just by calling custom asset function. Song interesting ? Let's try and check your monthly billing. You will ever want to treat me beer for that.

Theory
------

[](#theory)

I found out that I have to bill $50 per month for one of my application that is using s3. For read requests, it is like 46$. But only 4$ for put and delete requests. Therefore, If I can reduce the amout of read requests, I only have to pay like $6 per month. And this library emerge.

Library Design
--------------

[](#library-design)

This is the concept of chaining the responsiblity. When you use s3\_reducer

```

```

like this, the library will check local filesystem first. If the library exists in local it will server from local cache. If the libary cant find it on local server, it will download the asset from the s3 server and store it on local server. After that it will serve assets to the user. Therefore, you will only have to pay for s3 when no local cache file is exist.

Why Just Dont Use Local Filesystem
----------------------------------

[](#why-just-dont-use-local-filesystem)

You might claim that why just don't use local file system if the libary behind the sense store image in local to cache the s3 assets. Well, what happens if your server crush, your important assets will lost forever. And your vps server have limited data storage, mean while you can upload unlimited to the s3.

Your local won't full storage ? You said library download from s3 and serve from local server ?
-----------------------------------------------------------------------------------------------

[](#your-local-wont-full-storage--you-said-library-download-from-s3-and-serve-from-local-server-)

No, you can clear those cache, at a certain time by running cron job. Your server won't full with storage. Daily, weekly or monthly ? It just depends on your configuration.

Structure
---------

[](#structure)

If any of the following are applicable to your project, then the directory structure should follow industry best practices by being named the following.

```
config/
src/
tests/

```

Install
-------

[](#install)

Via Composer

```
$ composer require pyaesone17/s3-reducer
```

If you are using below laravel 5.4, you have to register service provider like this.

```
'providers' => [
    Pyaesone17\S3ReducerS3\ReducerServiceProvider::class
]
```

Usage
-----

[](#usage)

I recommend to use unique image path when uploading to s3 server. Because this library will make folder like s3 bucket style.

```
$ php artisan storage:link
```

```

```

Purge Cache
-----------

[](#purge-cache)

If you are using unique path style for every image upload. You don't have to purge the cache of assets. To clear the local cache image, you can even use this function.

```
s3_reduce_purge($image->path);
```

Cron Job
--------

[](#cron-job)

To avoid, you local server full with s3 images. You should add task scheduling like this in App\\Console\\Kernel.php

```
$schedule->command('s3reducer:purge')->weekly();
```

Testing
-------

[](#testing)

```
$ composer test
```

Note
----

[](#note)

It is just for showing frequent read requests to s3 assets. But for manipulating media, you should try to do it on actual s3 storage. For developer with devops experienced, I still recommend to use nginx cache to do this better performance.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 63.6% 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 ~0 days

Total

3

Last Release

2971d ago

Major Versions

0.0.2 → 1.0.02018-03-22

### Community

Maintainers

![](https://www.gravatar.com/avatar/b26ece37ce14b1b12f7b2048da1606b12c25a612fbcdd5c02db578354b633007?d=identicon)[pyaesone17](/maintainers/pyaesone17)

---

Top Contributors

[![pyaesone17](https://avatars.githubusercontent.com/u/11407146?v=4)](https://github.com/pyaesone17 "pyaesone17 (7 commits)")[![nyanwin](https://avatars.githubusercontent.com/u/7732452?v=4)](https://github.com/nyanwin "nyanwin (4 commits)")

---

Tags

laravellaravel-s3s3s3-cachepyaesone17S3Reducer

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/pyaesone17-s3-reducer/health.svg)

```
[![Health](https://phpackages.com/badges/pyaesone17-s3-reducer/health.svg)](https://phpackages.com/packages/pyaesone17-s3-reducer)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M686](/packages/barryvdh-laravel-ide-helper)[illuminate/pipeline

The Illuminate Pipeline package.

9446.6M211](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)[illuminate/cookie

The Illuminate Cookie package.

224.3M122](/packages/illuminate-cookie)

PHPackages © 2026

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