PHPackages                             biigle/laravel-image-cache - 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. [Caching](/categories/caching)
4. /
5. biigle/laravel-image-cache

Abandoned → [biigle/laravel-file-cache](/?search=biigle%2Flaravel-file-cache)Library[Caching](/categories/caching)

biigle/laravel-image-cache
==========================

Fetch and cache files from local filesystem, cloud storage or public webservers in Laravel

v3.2.3(4y ago)6194MITPHPCI passing

Since Oct 11Pushed 12mo ago2 watchersCompare

[ Source](https://github.com/biigle/laravel-image-cache)[ Packagist](https://packagist.org/packages/biigle/laravel-image-cache)[ RSS](/packages/biigle-laravel-image-cache/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (7)Versions (31)Used By (0)

File Cache
==========

[](#file-cache)

Fetch and cache files from local filesystem, cloud storage or public webservers in Laravel or Lumen.

The file cache is specifically designed for use in concurrent processing with multiple parallel queue workers.

[![Tests](https://github.com/biigle/laravel-file-cache/actions/workflows/tests.yml/badge.svg)](https://github.com/biigle/laravel-file-cache/actions/workflows/tests.yml)

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

[](#installation)

```
composer require biigle/laravel-file-cache

```

### Laravel

[](#laravel)

The service provider and `FileCache` facade are auto-discovered by Laravel.

### Lumen

[](#lumen)

Add this to `bootstrap/app.php`:

```
$app->register(Biigle\FileCache\FileCacheServiceProvider::class);
$app->register(Illuminate\Filesystem\FilesystemServiceProvider::class);
```

To use the `FileCache` facade, enable `$app->withFacades()` and add the following to `bootstrap/app.php`:

```
if (!class_exists(FileCache::class)) {
    class_alias(Biigle\FileCache\Facades\FileCache::class, 'FileCache');
}
```

Without facades, the file cache instance is available as `app('file-cache')`.

Usage
-----

[](#usage)

Take a look at the [`FileCache`](src/Contracts/FileCache.php) contract to see the public API of the file cache. Example:

```
use FileCache;
use Biigle\FileCache\GenericFile;

// Implements Biigle\FileCache\Contracts\File.
$file = new GenericFile('https://example.com/images/image.jpg');

FileCache::get($file, function ($file, $path) {
    // do stuff
});
```

If the file URL specifies another protocol than `http` or `https` (e.g. `mydisk://images/image.jpg`), the file cache looks for the file in the appropriate storage disk configured at `filesystems.disks`. You can not use a local file path as URL (e.g. `/vol/images/image.jpg`). Instead, configure a storage disk with the `local` driver.

Configuration
-------------

[](#configuration)

The file cache comes with a sensible default configuration. You can override it in the `file-cache` namespace or with environment variables.

### file-cache.max\_file\_size

[](#file-cachemax_file_size)

Default: `-1` (any size) Environment: `FILE_CACHE_MAX_FILE_SIZE`

Maximum allowed size of a cached file in bytes. Set to `-1` to allow any size.

### file-cache.max\_age

[](#file-cachemax_age)

Default: `60`Environment: `FILE_CACHE_MAX_AGE`

Maximum age in minutes of a file in the cache. Older files are pruned.

### file-cache.max\_size

[](#file-cachemax_size)

Default: `1E+9` (1 GB) Environment: `FILE_CACHE_MAX_SIZE`

Maximum size (soft limit) of the file cache in bytes. If the cache exceeds this size, old files are pruned.

### file-cache.path

[](#file-cachepath)

Default: `'storage/framework/cache/files'`

Directory to use for the file cache.

### file-cache.timeout

[](#file-cachetimeout)

Default: `5.0`Environment: `FILE_CACHE_TIMEOUT`

Read timeout in seconds for fetching remote files. If the stream transmits no data for longer than this period (or cannot be established), caching the file fails.

### file-cache.prune\_interval

[](#file-cacheprune_interval)

Default `'*/5 * * * *'` (every five minutes)

Interval for the scheduled task to prune the file cache.

### file-cache.mime\_types

[](#file-cachemime_types)

Default: `[]` (allow all types)

Array of allowed MIME types for cached files. Caching of files with other types will fail.

Clearing
--------

[](#clearing)

The file cache is cleared when you call `php artisan cache:clear`.

Testing
-------

[](#testing)

The `FileCache` facade provides a fake for easy testing. The fake does not actually fetch and store any files, but only executes the callback function with a faked file path.

```
use FileCache;
use Biigle\FileCache\GenericFile;

FileCache::fake();
$file = new GenericFile('https://example.com/image.jpg');
$path = FileCache::get($file, function ($file, $path) {
    return $path;
});

$this->assertFalse($this->app['files']->exists($path));
```

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity72

Established project with proven stability

 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 ~40 days

Recently: every ~128 days

Total

29

Last Release

1628d ago

Major Versions

v0.3.0 → v1.0.02018-10-11

v1.1.3 → v2.0.02019-02-05

v2.2.5 → v3.0.02019-09-12

v2.2.6 → v3.1.32020-05-18

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2457311?v=4)[Martin Zurowietz](/maintainers/mzur)[@mzur](https://github.com/mzur)

---

Top Contributors

[![mzur](https://avatars.githubusercontent.com/u/2457311?v=4)](https://github.com/mzur "mzur (103 commits)")

---

Tags

cachefilelaravellumen

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/biigle-laravel-image-cache/health.svg)

```
[![Health](https://phpackages.com/badges/biigle-laravel-image-cache/health.svg)](https://phpackages.com/packages/biigle-laravel-image-cache)
```

###  Alternatives

[spatie/laravel-backup

A Laravel package to backup your application

6.0k21.8M188](/packages/spatie-laravel-backup)[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)[laravel/ui

Laravel UI utilities and presets.

2.7k134.9M599](/packages/laravel-ui)[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k8.2M51](/packages/spatie-laravel-responsecache)[genealabs/laravel-model-caching

Automatic caching for Eloquent models.

2.4k4.8M26](/packages/genealabs-laravel-model-caching)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)

PHPackages © 2026

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