PHPackages                             hryvinskyi/magento2-external-media-prefetcher - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. hryvinskyi/magento2-external-media-prefetcher

ActiveMagento2-module[File &amp; Storage](/categories/file-storage)

hryvinskyi/magento2-external-media-prefetcher
=============================================

N/A

1.0.2(1y ago)44121MITPHP

Since Apr 17Pushed 1y ago1 watchersCompare

[ Source](https://github.com/hryvinskyi/magento2-external-media-prefetcher)[ Packagist](https://packagist.org/packages/hryvinskyi/magento2-external-media-prefetcher)[ RSS](/packages/hryvinskyi-magento2-external-media-prefetcher/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (4)Used By (0)

External Media Prefetcher for Magento 2
=======================================

[](#external-media-prefetcher-for-magento-2)

A Magento 2 module that automatically fetches missing media files from an external source.

Description
-----------

[](#description)

This module solves the common problem of missing media files in development or staging environments. When a media file is requested but not found locally, the module automatically attempts to download it from a configured external URL (such as your production site).

Requirements
------------

[](#requirements)

- Magento 2.4.x
- PHP 7.4 or higher

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

[](#installation)

### Using Composer (recommended)

[](#using-composer-recommended)

```
composer require hryvinskyi/magento2-external-media-prefetcher
bin/magento module:enable Hryvinskyi_ExternalMediaPrefetcher
bin/magento setup:upgrade
```

### Manual Installation

[](#manual-installation)

1. Create the following directory in your Magento installation: `app/code/Hryvinskyi/ExternalMediaPrefetcher`
2. Copy the module files to this directory
3. Enable the module and update the database: ```
    bin/magento module:enable Hryvinskyi_ExternalMediaPrefetcher
    bin/magento setup:upgrade
    ```

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

[](#configuration)

Modify your staging or local environment's `app/etc/env.php` file and add this configuration under the `system` key:

```
    'system' => [
        'default' => [
            'external_media_prefetcher' => [
                'general' => [
                    'enabled' => 1,
                    'external_media_url' => 'https://www.example.com/media/'
                ]
            ]
        ]
    ]
```

- **external\_media\_prefetcher/general/enabled**: Set to `1` to enable the module or `0` to disable it.
- **external\_media\_prefetcher/general/external\_media\_url**: Set the base URL where media files should be fetched from (e.g., `https://www.example.com/media/`)

You can also set this configuration through cli commands:

```
bin/magento config:set external_media_prefetcher/general/enabled 1 --lock-env
bin/magento config:set external_media_prefetcher/general/external_media_url https://www.example.com/media/ --lock-env
```

How It Works
------------

[](#how-it-works)

When a media file is requested but not found locally:

1. The module intercepts the request through a plugin on `Magento\MediaStorage\Model\File\Storage\Synchronization`
2. It cleans the path if it contains cache information
3. It constructs the external URL by combining the configured external media URL with the requested file path
4. It creates the necessary directory structure locally
5. It downloads the file from the external source and saves it to the local filesystem

Why it's Useful
---------------

[](#why-its-useful)

- **Development and Staging**: Easily sync media files from production to development or staging environments.
- **Missing Files**: Automatically fetch missing files without manual intervention.
- **Efficiency**: Saves time and effort in managing media files across different environments.

License
-------

[](#license)

[MIT](LICENSE)

Author
------

[](#author)

Volodymyr Hryvinskyi
Email:
GitHub:

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance49

Moderate activity, may be stable

Popularity21

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

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

Total

3

Last Release

370d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/9294098?v=4)[Volodymyr Hryvinskyi](/maintainers/hryvinskyi)[@hryvinskyi](https://github.com/hryvinskyi)

---

Top Contributors

[![hryvinskyi](https://avatars.githubusercontent.com/u/9294098?v=4)](https://github.com/hryvinskyi "hryvinskyi (5 commits)")

### Embed Badge

![Health badge](/badges/hryvinskyi-magento2-external-media-prefetcher/health.svg)

```
[![Health](https://phpackages.com/badges/hryvinskyi-magento2-external-media-prefetcher/health.svg)](https://phpackages.com/packages/hryvinskyi-magento2-external-media-prefetcher)
```

PHPackages © 2026

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