PHPackages                             pteal79/mobile-file-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. pteal79/mobile-file-cache

ActiveLibrary

pteal79/mobile-file-cache
=========================

Offline-friendly remote file caching for NativePHP and Laravel.

1.0.0(1mo ago)05↑2900%MITPHPPHP ^8.2

Since Mar 29Pushed 1mo agoCompare

[ Source](https://github.com/pteal79/mobile-file-cache)[ Packagist](https://packagist.org/packages/pteal79/mobile-file-cache)[ RSS](/packages/pteal79-mobile-file-cache/feed)WikiDiscussions main Synced 1mo ago

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

Mobile File Cache
=================

[](#mobile-file-cache)

Offline-friendly remote file caching for Laravel 12, NativePHP 3.1, and Livewire 3.

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

[](#installation)

```
composer require pteal79/mobile-file-cache
php artisan vendor:publish --tag=mobile-file-cache-config
php artisan vendor:publish --tag=mobile-file-cache-migrations
php artisan migrate
```

Config
------

[](#config)

```
return [
    'disk' => env('MOBILE_FILE_CACHE_DISK', 'mobile_public'),
    'directory' => env('MOBILE_FILE_CACHE_DIRECTORY', 'cached_files'),
    'cleanup_after_days' => 30,
    'max_file_size_mb' => 30,
    'timeout' => 60,
    'allowed_mime_types' => [
        'application/pdf',
        'image/jpeg',
        'image/png',
        'image/gif',
        'image/webp',
        'image/svg+xml',
    ],
    'queue' => [
        'tries' => 3,
        'backoff' => [5, 30, 120],
        'http_retries' => 3,
        'http_retry_sleep_ms' => 250,
    ],
];
```

Usage
-----

[](#usage)

```
use MobileFileCache;

$displayableUrl = MobileFileCache::get($remoteUrl);
$absolutePath = MobileFileCache::get($remoteUrl, true);

MobileFileCache::cache($remoteUrl);
MobileFileCache::invalidate($remoteUrl);

$totalBytes = MobileFileCache::totalCacheSize();
$totalFiles = MobileFileCache::totalCacheRecords();

MobileFileCache::clearAged();
MobileFileCache::clear();
```

### Observer example

[](#observer-example)

```
public function created(SomeModel $model): void
{
    if ($model->remote_image_url) {
        MobileFileCache::cache($model->remote_image_url);
    }
}
```

Notes
-----

[](#notes)

- Full URLs are hashed including query parameters, so signed or versioned file URLs are cached independently.
- `MobileFileCache::get()` returns the original URL until the queued download has completed.
- Cached files are stored under the configured disk in the `cached_files/` directory by default.
- Only images and PDFs are cached by default through MIME validation.
- Files larger than 30 MB are skipped.
- The queue job supports configurable queue retries and HTTP retries.
- `file-cache:clean-up` removes aged entries using the configured retention period.

Testing
-------

[](#testing)

```
composer test
```

Allowed MIME types
------------------

[](#allowed-mime-types)

By default the package caches PDFs and common image formats, including HEIC/HEIF (`image/heic`, `image/heif`).

Batched worker queue flow
-------------------------

[](#batched-worker-queue-flow)

`MobileFileCache::cache($url)` now creates a deduplicated pending request instead of dispatching one download job per URL.

`MobileFileCache::hasPendingRequests()` returns a boolean indicating whether pending cache requests exist. When pending requests are present, the package dispatches a unique `CacheFileWorker` job onto Laravel's default queue. The worker processes pending requests in batches and re-dispatches itself if more work remains.

New table: `mobile_file_cache_pending_requests`

This table stores outstanding cache requests, deduplicated by the full remote URL hash.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance90

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

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

Unknown

Total

1

Last Release

45d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/167c450c5528b16682698e73dc0a8cb5b537244340d1696502cfc3f3f92ebdd1?d=identicon)[pteal79](/maintainers/pteal79)

---

Top Contributors

[![Elite-Cleaning](https://avatars.githubusercontent.com/u/102381701?v=4)](https://github.com/Elite-Cleaning "Elite-Cleaning (3 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/pteal79-mobile-file-cache/health.svg)

```
[![Health](https://phpackages.com/badges/pteal79-mobile-file-cache/health.svg)](https://phpackages.com/packages/pteal79-mobile-file-cache)
```

###  Alternatives

[laravel/scout

Laravel Scout provides a driver based solution to searching your Eloquent models.

1.7k49.4M479](/packages/laravel-scout)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

44643.1k1](/packages/pressbooks-pressbooks)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)

PHPackages © 2026

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