# fastly/magento2

> Fastly CDN Module for Magento 2.4.x

`composer require fastly/magento2`

Canonical URL: https://packagento.com/fastly/magento2

## At a glance

- **Vendor**: fastly (https://packagento.com/fastly.md)
- **Latest version**: 1.2.245 — released 2026-07-07
- **Pricing**: Free
- **Package type**: Magento 2 module
- **Status**: active, accepting new buyers

## Installation

Packagento is licence-gated, so even free packages need a licence on a project before Composer can resolve them.

1. **Sign in or create an account** at https://packagento.com/customer/account/.

2. **Add the package to your account.** Open https://packagento.com/fastly/magento2 and complete the free checkout. A licence is minted automatically.

3. **Create or pick a project, then activate the licence on it.**
   - Projects represent the Magento installs you deploy to. Manage them at https://packagento.com/projects/.
   - Activate the new licence on the project you'll deploy this package to. Activation is what generates the Composer credentials scoped to that project.

4. **Add the project credentials to your Magento codebase.**

   Grab the project's public + private key from https://packagento.com/projects/ (open the project, then its Credentials tab), and add them to `auth.json`:

   ```json
   {
     "http-basic": {
       "packagento.com": {
         "username": "ppk_live_...",
         "password": "psk_live_..."
       }
     }
   }
   ```

   Add the Packagento Composer repository to `composer.json`:

   ```json
   {
     "repositories": [
       { "type": "composer", "url": "https://packagento.com" }
     ]
   }
   ```

5. **Install and apply.**

   ```bash
   composer require fastly/magento2:*
   bin/magento setup:upgrade
   bin/magento setup:di:compile
   bin/magento cache:flush
   ```

## What it does

Fastly CDN Module for Magento 2.4.x

## README

Thank you for using the "Fastly CDN module for Magento2" (Fastly_Cdn).

This package contains everything you need to connect fastly.com (Fastly) with
your Magento commerce shop and to get the most out of Fastly's powerful caching
capabilities for a blazing fast e-commerce site.

### Contents

- [Description](#description)
- [Documentation](#documentation)
- [Support](#support)
- [Features](#features)
- [Contributing](#contributing)

### Description

The Fastly_Cdn module relies on Magento2's page cache functionality and extends
its Varnish capabilities to leverage Fastly's enhanced caching technology and
Geo-IP support.

The second component, the VCL, configures Fastly's Varnish to process the
client requests and Magento's HTML responses according to the Cache-Control
headers the Fastly_Cdn module adds to every response.

### Documentation

Documentation for this module can be found in the
[Documentation](Documentation/)
folder.

- [Installation instructions](Documentation/INSTALLATION.md)
- [Configuration instructions](Documentation/CONFIGURATION.md)
- [TLS configuration instructions](Documentation/TLS.md)
- [Purging and Other Functions](Documentation/OTHER-FUNCTIONS.md)
- [Troubleshooting instructions](Documentation/TROUBLESHOOTING.md)
- [How to report bugs](Documentation/OPENING-ISSUES.md)

### Support

Help using this module can be found by posting to
[Fastly's community forum](https://community.fastly.com/).

For Fastly customers with a [Support Package](https://www.fastly.com/support)
please reach out via the normal channels.

If there are issues/errors with integrating the module, please post
[details](Documentation/OPENING-ISSUES.md) in the GitHub repository issues.

### Features

The module utilises a number of features of Fastly's services. This section
will provide a brief overview of the ones available in the Fastly_Cdn module.

**Geo IP Detection:** Using the client's IP this allows a regional store to be
delivered to the user.

**Serving Stale on Errors:** This allows an expired copy of content to be used
in case of errors on the origin. This prevents site outages being visible to users.

**Serving Stale while Revalidating:** This allows an expired copy of content to
be served while the content is refreshed from origin. This maintains
performance while keeping a fresh cache.

**Soft Purging:** This marks content as expired (before the TTL). Using this
means that content can be freshened actively while using stale content to users
for a fast site.

**N.B.** More in-depth explanations of these features can be found in
[Fastly's Documentation](https://docs.fastly.com/).

### Contributing

We welcome pull requests for issues and new functionality. Please see
[Contributing](Documentation/CONTRIBUTING.md) for more details.

## Recent Versions

| Version | Released |
|---|---|
| 1.2.245 | 2026-07-07 |
| 1.2.244 | 2026-06-01 |
| 1.2.243 | 2026-04-28 |
| 1.2.242 | 2026-04-07 |
| 1.2.241 | 2026-03-30 |
| 1.2.240 | 2026-03-09 |
| 1.2.239 | 2026-03-03 |
| 1.2.238 | 2026-02-03 |
| 1.2.237 | 2026-02-02 |
| 1.2.236 | 2025-10-30 |

Showing 10 of 269 versions. Full release history on https://packagento.com/fastly/magento2.

## Dependencies

### Require

| Package | Constraint |
|---|---|
| laminas/laminas-http | ^2.6.0 |
| magento/framework | >=103.0.0 |
| magento/module-cache-invalidate | >=100.4.0 |
| magento/module-config | >=101.2.0 |
| magento/module-page-cache | >=100.4.0 |
| magento/module-store | >=101.1.0 |
| php | ~7.3.0\|~7.4.0\|~8.0.0\|~8.1.0\|~8.2.0\|~8.3.0\|~8.4.0\|~8.5.0 |
| zordius/lightncandy | ^1.2 |

## Quality

Latest release (1.2.245) fails the Packagento QA pipeline. Verdicts below are per-cell (Magento line × PHP version) for the matrixed tools, and run-once for the static / security tiers.


### Compatibility

Each Magento line is installed on its supported PHP versions, then the module is built (DI compile + static-content deploy). Cells show passed / failed / untested; staircase gaps render as `–`.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | Pass | Pass | – | – |
| 2.4.8 | – | Pass | Pass | – |
| 2.4.9 | – | – | Pass | Pass |


### Code Quality

Advisory checks against the module's source. Never affect the Compatibility verdict — a phpcs finding can't make a module incompatible.

#### Static Analysis

Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| PHPCS | Warning | 1598 | 1598 warnings (ruleset: Magento2), 1144 auto-fixable with phpcbf |
| PHPMD | Warning | 146 | 146 rule violations (UnusedFormalParameter:50, MissingImport:15, UnusedLocalVariable:15, UndefinedVariable:15, CyclomaticComplexity:11) |
| Cpd | Warning | 34 | 34 duplicated chunks spanning 2065 total lines (min-lines=5, min-tokens=70) |
| Composer validate | Info | 6 | valid; 6 advisory notes (composer validate --strict) |

#### PHPStan

Type-checks the module against a real Magento install. Re-runs per Magento + PHP version because resolvable symbols differ between releases.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | 305 | 305 | – | – |
| 2.4.8 | – | 305 | 305 | – |
| 2.4.9 | – | – | 278 | 278 |


### Tests

Unit and integration suites run per Magento + PHP cell. Test failures speak to the module's behaviour, not its compatibility with a line, so they're reported here separately.

#### Unit Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |

#### Integration Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |


### Security

Dependency-advisory audit (composer audit) plus a source malware scan. A malware detection fails the version outright.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| Composer audit | Pass | 0 |  |
| Malware scan | Pass | 0 |  |

## Licence and pricing

Free. A licence is still minted on checkout and bound to your project for Composer access — no payment step.

Refundable within 14 days of first purchase via https://packagento.com/account/refunds/.

## Install via Claude Code or any MCP client

The Packagento MCP server can run the licence + project + Composer steps above in one tool call:

```
purchase_and_install_packages(
  composer_names=["fastly/magento2"],
  project_id="proj_xxx"
)
```

This handles cart, checkout, licence minting, project activation, and writes auth.json credentials. Connect a client with `claude mcp add packagento https://mcp.packagento.com`. Full setup at https://packagento.com/docs/mcp-setup.

## Vendor

fastly is a Magento 2 vendor on Packagento. See https://packagento.com/fastly.md for their full catalogue.

