https://github.com/markshust/magento2-module-specialrouter
The SpecialRouter module adds the ability to use special characters in URLs.
https://github.com/markshust/magento2-module-specialrouter
Last synced: about 1 year ago
JSON representation
The SpecialRouter module adds the ability to use special characters in URLs.
- Host: GitHub
- URL: https://github.com/markshust/magento2-module-specialrouter
- Owner: markshust
- License: mit
- Created: 2022-12-16T18:14:24.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-13T14:38:50.000Z (about 2 years ago)
- Last Synced: 2024-05-02T00:45:51.509Z (about 2 years ago)
- Language: PHP
- Size: 21.5 KB
- Stars: 10
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
MarkShust_SpecialRouter
## Table of contents
- [Summary](#summary)
- [Installation](#installation)
- [Usage](#usage)
- [Credits](#credits)
- [License](#license)
## Summary
Magento does not provide the ability to set special characters on controller or action names. This module fixes that by providing the ability to use `-`, `.`, `~`, `_` within a URL.
## Installation
```
composer require markshust/magento2-module-specialrouter
bin/magento module:enable MarkShust_SpecialRouter
bin/magento setup:upgrade
```
## Usage
This module is really simple to use. All you need to do is use the appropriate "name" that matches the symbol you'd like to use in the URL.
- Symbol: `-`, Name: `Dash`
- Symbol: `.`, Name: `Period`
- Symbol: `~`, Name: `Tilda`
- Symbol: `_`, Name: `Underscore`
For example, to respond to a request with a `frontName` of `foo` at the following location:
```
/foo/alpha-beta/charlie-delta
```
Use a PHP class named:
```
Controller/AlphaDashBeta/CharlieDashDelta.php
```
The `-` in the URL will be translated to `dash` in the actionPath and actionName, so if we create files using `Dash` in the controller and action name, they will respond to these requests.
## Credits
### M.academy
This course is sponsored by M.academy, the simplest way to learn Magento.
### Mark Shust
My name is Mark Shust and I'm the creator of this repo. I'm a 6X Adobe Commerce Certified Developer and have been involved with Magento since the early days (v0.8!). I create technical education courses full-time for my company, M.academy.
- 🖥️ See my Magento lessons & courses
- 📖 Read my technical articles
- 🎥 Watch my YouTube videos
- 🔗 Connect on LinkedIn
- 🐦 Follow me on X
- 💌 Contact me
## License
[MIT](https://opensource.org/licenses/MIT)
