PHPackages                             mgh-tech/magento2-dev-media-downloader - 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. mgh-tech/magento2-dev-media-downloader

ActiveMagento2-module[Utility &amp; Helpers](/categories/utility)

mgh-tech/magento2-dev-media-downloader
======================================

Magento 2 module for on-demand downloading of missing media files from a remote instance during development.

1.0.1(5mo ago)341MITPHPPHP &gt;=7.4

Since Dec 11Pushed 5mo agoCompare

[ Source](https://github.com/mgh-tech/magento2-dev-media-downloader)[ Packagist](https://packagist.org/packages/mgh-tech/magento2-dev-media-downloader)[ RSS](/packages/mgh-tech-magento2-dev-media-downloader/feed)WikiDiscussions main Synced 1mo ago

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

MGH DevMediaDownloader
======================

[](#mgh-devmediadownloader)

[![Latest Stable Version](https://camo.githubusercontent.com/f61da3eee6ee2fdacf5f06883c9d076d0204768ae962878412cec9935d147764/687474703a2f2f706f7365722e707567782e6f72672f6d67682d746563682f6d6167656e746f322d6465762d6d656469612d646f776e6c6f616465722f76)](https://packagist.org/packages/mgh-tech/magento2-dev-media-downloader) [![Total Downloads](https://camo.githubusercontent.com/a8b1880db6a18a38942474ed4c0dce75112d78fa930a5468a848de7c1f5ecb77/687474703a2f2f706f7365722e707567782e6f72672f6d67682d746563682f6d6167656e746f322d6465762d6d656469612d646f776e6c6f616465722f646f776e6c6f616473)](https://packagist.org/packages/mgh-tech/magento2-dev-media-downloader) [![Latest Unstable Version](https://camo.githubusercontent.com/3bfbff26b71b0408183cdfa4b086498453c3b17a2191428e9df3dc2ec212d900/687474703a2f2f706f7365722e707567782e6f72672f6d67682d746563682f6d6167656e746f322d6465762d6d656469612d646f776e6c6f616465722f762f756e737461626c65)](https://packagist.org/packages/mgh-tech/magento2-dev-media-downloader) [![License](https://camo.githubusercontent.com/2635b7a93ae16459609befca54f23c6e78081aec2e97d51bc98681cd11fd616c/687474703a2f2f706f7365722e707567782e6f72672f6d67682d746563682f6d6167656e746f322d6465762d6d656469612d646f776e6c6f616465722f6c6963656e7365)](https://packagist.org/packages/mgh-tech/magento2-dev-media-downloader) [![PHP Version Require](https://camo.githubusercontent.com/8969be64edd568ecb38c593a9b99454ef085d0f264137ee18a90066ed2742d67/687474703a2f2f706f7365722e707567782e6f72672f6d67682d746563682f6d6167656e746f322d6465762d6d656469612d646f776e6c6f616465722f726571756972652f706870)](https://packagist.org/packages/mgh-tech/magento2-dev-media-downloader)

A lightweight Magento 2 module for on-demand downloading of missing media files from a remote instance during development and testing.

Overview
--------

[](#overview)

**MGH\\DevMediaDownloader** streamlines development and testing workflows by automatically downloading missing media files (such as product images) from a remote Magento instance. This module is designed for development, staging, or CI environments where the full media library is not available locally, but is accessible from a production or reference server.

Problem &amp; Solution
----------------------

[](#problem--solution)

Working with a local development environment often means missing large media files. Rather than synchronizing entire media folders, this module intelligently fetches media assets on-demand from your remote instance, improving both developer experience and CI/CD efficiency.

### How It Works

[](#how-it-works)

When a media file (e.g., an image in `/pub/media/`) is requested and not found locally:

1. The module intercepts the request
2. Attempts to fetch the file from a configured remote base URL
3. If successful, saves it locally for future requests
4. Serves the file as if it were present from the start

### Workflow Diagram

[](#workflow-diagram)

```
┌─────────────────────────────────────────────────────────────────┐
│                    Request for Media File                       │
│              (e.g., /pub/media/catalog/product/...)             │
└─────────────────────┬───────────────────────────────────────────┘
                      │
                      ▼
        ┌─────────────────────────────┐
        │  File exists locally?       │
        └─────────────────────────────┘
               │           │
            YES│           │NO
               │           │
               │      ┌────▼────────────────────────────┐
               │      │ Module enabled & in dev mode?   │
               │      └────────┬────────────────────────┘
               │              │
               │            NO│ → Serve 404 or default
               │              │
               │            YES│
               │      ┌───────▼──────────────────────┐
               │      │ Build remote URL candidates  │
               │      │ (handle cache paths, etc.)   │
               │      └───────┬──────────────────────┘
               │              │
               │      ┌───────▼──────────────────────┐
               │      │ Try to download from remote  │
               │      │ (validate image type, etc.)  │
               │      └───────┬──────────────────────┘
               │              │
               │        ┌─────┴──────┐
               │      SUCCESS       FAIL
               │        │            │
               │    ┌───▼──────┐     └──→ Log error, serve 404
               │    │ Save file│
               │    │ locally  │
               │    └───┬──────┘
               │        │
               └────┬───┘
                    │
                    ▼
          ┌──────────────────────┐
          │  Serve file to client│
          └──────────────────────┘

```

Key Features
------------

[](#key-features)

- **Seamless on-demand downloading** of missing media files from a remote Magento instance
- **Intelligent caching** - once downloaded, files are stored locally for fast retrieval
- **Supports Magento's product image cache** structure and fallback logic
- **Safe downloads** - only downloads valid image files (jpg, jpeg, png, gif, webp, avif, svg)
- **Developer-mode only** - automatically disabled in production environments
- **Robust error handling** with comprehensive debug logging
- **Configurable remote base URL** - point to any Magento instance (support for multi-website setups)
- **Compatible with Fastly CDN** - includes dedicated plugin for Adobe Commerce with Fastly

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

[](#installation)

### Option 1: Via Composer (Recommended)

[](#option-1-via-composer-recommended)

```
composer require mgh-tech/magento2-dev-media-downloader
bin/magento setup:upgrade
```

### Option 2: Manual Installation

[](#option-2-manual-installation)

1. Place the module under `app/code/MGH/DevMediaDownloader` in your Magento 2 project:

    ```
    mkdir -p app/code/MGH/DevMediaDownloader
    # Copy module files into this directory
    ```
2. Register the module by running setup upgrade:

    ```
    bin/magento setup:upgrade
    ```
3. Configure the module (see Configuration section below)

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

[](#configuration)

The module provides the following configuration options under **Stores &gt; Configuration &gt; Dev Tools &gt; Dev Media Downloader**:

SettingTypeDescription**Enable On-The-Fly Download**BooleanToggle the module on/off. Only active in developer mode.**Remote Base URL**TextThe base URL of the remote Magento instance (e.g., `https://production.example.com`). Do not include a trailing slash.### Configuration via Admin Panel

[](#configuration-via-admin-panel)

1. Navigate to **Stores &gt; Configuration &gt; Dev Tools &gt; Dev Media Downloader**
2. Enable the module
3. Set the remote base URL

### Configuration via Command Line

[](#configuration-via-command-line)

Alternatively, configure the module using the command line:

```
# Enable the module
bin/magento config:set dev_media_downloader/general/enabled 1

# Set the remote base URL
bin/magento config:set dev_media_downloader/general/remote_base_url https://production.example.com

# For specific store view (optional)
bin/magento config:set --scope=stores --scope-id=1 dev_media_downloader/general/remote_base_url https://production.example.com
```

### Example Configuration

[](#example-configuration)

```
Remote Base URL: https://production.example.com
Enable: Yes

```

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

[](#requirements)

- **PHP** &gt;= 7.4
- **Magento** 2.4.x (or compatible OpenMage/Magento Open Source)
- **ext-curl** - PHP cURL extension (required for remote downloads)

Compatibility
-------------

[](#compatibility)

- ✅ Magento Open Source 2.4.x
- ✅ Adobe Commerce 2.4.x
- ✅ Adobe Commerce Cloud with Fastly CDN

License
-------

[](#license)

This module is licensed under the **MIT License**. See the [LICENSE.txt](LICENSE.txt) file for details.

Author
------

[](#author)

**mgh-tech** - Magento 2 Development &amp; Solutions
GitHub: [github.com/mgh-tech](https://github.com/mgh-tech)

Support &amp; Contributions
---------------------------

[](#support--contributions)

For issues, questions, or contributions, please visit the [GitHub repository](https://github.com/mgh-tech/magento2-dev-media-downloader).

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance73

Regular maintenance activity

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity36

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

Total

2

Last Release

152d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/64ca35b5ace40bdee9a932c0e2d1c0750ee403ee21a2b1ed92c3b165fb6673c0?d=identicon)[gharbi-mohamed](/maintainers/gharbi-mohamed)

---

Top Contributors

[![gharbi-mohamed](https://avatars.githubusercontent.com/u/11610880?v=4)](https://github.com/gharbi-mohamed "gharbi-mohamed (1 commits)")

### Embed Badge

![Health badge](/badges/mgh-tech-magento2-dev-media-downloader/health.svg)

```
[![Health](https://phpackages.com/badges/mgh-tech-magento2-dev-media-downloader/health.svg)](https://phpackages.com/packages/mgh-tech-magento2-dev-media-downloader)
```

###  Alternatives

[yireo/magento2-webp2

Magento 2 module to add WebP support to the Magento frontend

2091.2M7](/packages/yireo-magento2-webp2)[tig/postnl-magento2

TIG Magento 2 PostNL extension

58544.2k4](/packages/tig-postnl-magento2)[lillik/magento2-price-decimal

Magento 2 Price Decimal Precision

111147.5k](/packages/lillik-magento2-price-decimal)[nosto/module-nostotagging

Increase your conversion rate and average order value by delivering your customers personalized product recommendations throughout their shopping journey.

27659.1k4](/packages/nosto-module-nostotagging)[magepal/magento2-customeraccountlinksmanager

Customer Account Links Manager for Magento2 allows you to quickly and easily remove unwanted links from customer account dashboard

4084.9k](/packages/magepal-magento2-customeraccountlinksmanager)[doofinder/doofinder-magento2

Doofinder module for Magento 2

13204.0k1](/packages/doofinder-doofinder-magento2)

PHPackages © 2026

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