PHPackages                             rafafortes/cache-warmer - 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. rafafortes/cache-warmer

ActiveLibrary[Caching](/categories/caching)

rafafortes/cache-warmer
=======================

A simple Magento 2 cache warmer tool.

1.0.7(1y ago)12.0k↓56.7%2MITPHPPHP &gt;=8.0

Since Jan 26Pushed 1y ago1 watchersCompare

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

READMEChangelog (8)DependenciesVersions (9)Used By (0)

Cache Warmer for Magento 2
==========================

[](#cache-warmer-for-magento-2)

Cache Warmer is a PHP tool designed to crawl and cache all internal URLs of a Magento 2 store to improve page load speeds by preloading content into Varnish cache.

Features
--------

[](#features)

- Crawls all internal URLs starting from the homepage or URLs specified in the `urls` file.
- Extracts URLs from the store's `sitemap.xml`.
- Handles URL normalization and parameter variations.
- Skips unwanted file types (e.g., images, PDFs).
- Skips URLs based on a blacklist file with customizable patterns.
- Displays real-time processing details such as response codes and load times.
- Shows time in milliseconds for each URL loaded.
- Prevents duplicate URL processing.
- **Multi-threading:** Supports parallel processing of URLs to speed up the crawling process.
- **Debug mode:** Outputs all links found on each accessed page.

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

[](#installation)

### Using Composer

[](#using-composer)

To install the package via Composer, run the following command:

```
composer require rafafortes/cache-warmer
```

Alternatively, add the package manually to your `composer.json`:

```
{
    "require": {
        "rafafortes/cache-warmer": "^1.0"
    }
}
```

Then, run:

```
composer install
```

Usage
-----

[](#usage)

Once installed, you can run the script from the command line:

```
php vendor/rafafortes/cache-warmer/src/UrlFetcher.php   [--debug] []
```

### File-based URL Initialization

[](#file-based-url-initialization)

You can specify additional URLs to be crawled by creating a `urls` file in the root directory. This file should list one URL per line. The first URL in the file can also serve as the `baseUrl` if needed.

**Example `urls` file:**

```
https://example.com
https://example.com/page1
https://example.com/page2

```

### Multi-threading

[](#multi-threading)

You can specify the number of threads to process URLs in parallel by adding the number as the last parameter.

**Example with 5 threads:**

```
php vendor/rafafortes/cache-warmer/src/UrlFetcher.php https://example.com https://example.com/sitemap.xml --debug 5
```

If the number of threads is not specified, the default is 1 thread.

### Debug Mode

[](#debug-mode)

You can enable debug mode by adding the `--debug` parameter to the command. This mode outputs all URLs found on each accessed page.

**Example:**

```
php vendor/rafafortes/cache-warmer/src/UrlFetcher.php https://example.com https://example.com/sitemap.xml --debug
```

### Blacklist Configuration

[](#blacklist-configuration)

You can exclude specific URLs by adding patterns to a file named `blacklist` located in the same directory as the script. Each line of the file should contain a pattern to be ignored.

**Example `blacklist` file:**

```
productalert/add
checkout/cart
customer/account

```

The script will automatically load and apply the blacklist, skipping any URLs that contain the specified patterns.

### Output

[](#output)

The script will output information about each processed URL, including:

- Loading time (in milliseconds)
- HTTP response code
- Total number of URLs processed
- Execution time
- Number of skipped duplicate URLs
- URLs skipped due to blacklist rules (if any)

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

[](#requirements)

- PHP 8.0 or higher
- Composer

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

[](#configuration)

Ensure your project follows the correct directory structure for autoloading:

```
/project-root
├── composer.json
├── src
│   └── UrlFetcher.php
├── blacklist
├── urls
└── README.md

```

Contributing
------------

[](#contributing)

Contributions are welcome! Feel free to submit a pull request or open an issue to suggest improvements.

License
-------

[](#license)

This project is licensed under the MIT License.

Author
------

[](#author)

Developed by [Rafa Fortes](https://github.com/rafafortes).

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance42

Moderate activity, may be stable

Popularity23

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity48

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

Every ~0 days

Total

8

Last Release

475d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/20464782?v=4)[Rafael dos Passos Fortes](/maintainers/rafafortes)[@rafafortes](https://github.com/rafafortes)

---

Top Contributors

[![rafafortes](https://avatars.githubusercontent.com/u/20464782?v=4)](https://github.com/rafafortes "rafafortes (8 commits)")

### Embed Badge

![Health badge](/badges/rafafortes-cache-warmer/health.svg)

```
[![Health](https://phpackages.com/badges/rafafortes-cache-warmer/health.svg)](https://phpackages.com/packages/rafafortes-cache-warmer)
```

###  Alternatives

[react/cache

Async, Promise-based cache interface for ReactPHP

444112.4M40](/packages/react-cache)[wp-media/wp-rocket

Performance optimization plugin for WordPress

7431.3M3](/packages/wp-media-wp-rocket)[illuminate/cache

The Illuminate Cache package.

12835.6M1.4k](/packages/illuminate-cache)[colinmollenhour/php-redis-session-abstract

A Redis-based session handler with optimistic locking

6325.6M14](/packages/colinmollenhour-php-redis-session-abstract)[cheprasov/php-redis-client

Php client for Redis. It is a fast, fully-functional and user-friendly client for Redis, optimized for performance. RedisClient supports the latest versions of Redis starting from 2.6 to 6.0

1281.2M21](/packages/cheprasov-php-redis-client)[amphp/redis

Efficient asynchronous communication with Redis servers, enabling scalable and responsive data storage and retrieval.

165634.7k44](/packages/amphp-redis)

PHPackages © 2026

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