# opengento/module-store-path-url

> This module updates the store code path in url with the country code or a custom value.

`composer require opengento/module-store-path-url`

Canonical URL: https://packagento.com/opengento/module-store-path-url

## At a glance

- **Vendor**: opengento (https://packagento.com/opengento.md)
- **Latest version**: 4.1.9 — released 2025-09-26
- **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/opengento/module-store-path-url 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 opengento/module-store-path-url:*
   bin/magento setup:upgrade
   bin/magento setup:di:compile
   bin/magento cache:flush
   ```

## What it does

This module updates the store code path in url with the country code or a custom value.

## README

[![Latest Stable Version](https://img.shields.io/packagist/v/opengento/module-store-path-url.svg?style=flat-square)](https://packagist.org/packages/opengento/module-store-path-url)
[![License: MIT](https://img.shields.io/github/license/opengento/magento2-store-path-url.svg?style=flat-square)](./LICENSE) 
[![Packagist](https://img.shields.io/packagist/dt/opengento/module-store-path-url.svg?style=flat-square)](https://packagist.org/packages/opengento/module-store-path-url/stats)
[![Packagist](https://img.shields.io/packagist/dm/opengento/module-store-path-url.svg?style=flat-square)](https://packagist.org/packages/opengento/module-store-path-url/stats)

This module allows to override the store code in url with another path value.

 - [Setup](#setup)
   - [Composer installation](#composer-installation)
   - [Setup the module](#setup-the-module)
 - [Features](#features)
 - [Settings](#settings)
 - [Documentation](#documentation)
 - [Support](#support)
 - [Authors](#authors)
 - [License](#license)

### Setup

Magento 2 Open Source or Commerce edition is required.

#### Composer installation

Run the following composer command:

```
composer require opengento/module-store-path-url
```

#### Setup the module

Run the following magento command:

```
bin/magento setup:upgrade
```

**If you are in production mode, do not forget to recompile and redeploy the static resources.**

### Features

The module allows to replace the store code in url with the following options:  

- Country Code, e.g: be
- Language Code, e.g: fr
- Locale Code (separated with a hyphen), e.g: fr-be
- Locale Code (separated with an underscore), e.g: fr_be
- Custom (you can setup the path of your choice), e.g: emea

This module also allows you to remove the store path in the url for websites with a single store view. This may be useful for stores with dedicated domains. This setting is automatically enabled if you choose to use the custom mapper. However, if a single store exists for a website, and a path is setup within the mapper, the path is not unset, meaning that the path configured in the mapper is used.  

Besides that, this module makes the usage of the MAGE_RUN_TYPE and MAGE_RUN_CODE variables optionals. Magento is going to be able to resolve the correct store based on its base web URL. This setting can be disabled, see "Use Base Url Resolver".

### Settings

The configuration for this module is available in `Stores > Configuration > Web > Url`.  

### Documentation

In order to use this module, you must enable the following setting: "Add Store Code to Urls" (`web/url/use_store`).  
A new field is added in the configuration: "Store Path Url" and "Custom Path Mapper" if the "custom" value is selected.  
The store path config are:  

- `web/url/store_path_url`
- `web/url/custom_path_mapper`
- `unset_single_store_path`
- `base_url_resolver`

### Support

Raise a new [request](https://github.com/opengento/magento2-store-path-url/issues) to the issue tracker.

### Authors

- **Opengento Community** - *Lead* - [![Twitter Follow](https://img.shields.io/twitter/follow/opengento.svg?style=social)](https://twitter.com/opengento)
- **Thomas Klein** - *Maintainer* - [![GitHub followers](https://img.shields.io/github/followers/thomas-kl1.svg?style=social)](https://github.com/thomas-kl1)
- **Contributors** - *Contributor* - [![GitHub contributors](https://img.shields.io/github/contributors/opengento/magento2-store-path-url.svg?style=flat-square)](https://github.com/opengento/magento2-store-path-url/graphs/contributors)

### License

This project is licensed under the MIT License - see the [LICENSE](./LICENSE) details.

***That's all folks!***

## Recent Versions

| Version | Released |
|---|---|
| 4.1.9 | 2025-09-26 |
| 4.1.8 | 2025-09-09 |
| 4.1.7 | 2025-04-11 |
| 4.1.6 | 2025-03-20 |
| 4.1.5 | 2025-02-10 |
| 4.1.4 | 2024-09-20 |
| 4.1.3 | 2024-05-23 |
| 4.1.2 | 2024-05-23 |
| 4.1.1 | 2024-05-13 |
| 4.1.0 | 2024-05-07 |

Showing 10 of 28 versions. Full release history on https://packagento.com/opengento/module-store-path-url.

## Dependencies

### Require

| Package | Constraint |
|---|---|
| magento/framework | * |
| magento/module-config | * |
| magento/module-directory | * |
| magento/module-store | * |
| magento/module-url-rewrite | * |
| php | ^8.1 |
| psr/log | * |

### Require (dev)

| Package | Constraint |
|---|---|
| magento/magento-coding-standard | ^33 |
| roave/security-advisories | dev-latest |

## Quality

Latest release (4.1.9) 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 | 30 | 30 warnings (ruleset: Magento2) — 14 auto-fixable with phpcbf |
| PHPMD | Warning | 9 | 9 rule violations (UnusedFormalParameter:8, EmptyCatchBlock:1) |
| Cpd | Pass | 0 |  |
| 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 | 3 | 3 | – | – |
| 2.4.8 | – | 3 | 3 | – |
| 2.4.9 | – | – | 3 | 3 |


### 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=["opengento/module-store-path-url"],
  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

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

