yireo / magento2-corshack
yireo/magento2-corshack
Magento 2 module to add some hacks to GraphQL API
Yireo CorsHack
The new Magento 2.3 GraphQL system could be used with GraphQL clients
(like Apollo or even Axios) to fetch data from Magento. Most of these
clients use an HTTP request OPTIONS to see if CORS restrictions apply.
This module adds an OPTIONS check to the GraphQL API. Also, this module
adds Cross Origin headers (currently hard-coded to
http://localhost:3000).
Installation
composer require yireo-training/magento2-corshack
./bin/magento module:enable Yireo_CorsHack
Configuration
Navigate to Advanced > Yireo CorsHack and add your URLs to the Origin Domain option.
By default, the following URLs work right away:
http://localhost/http://localhost:3000/
If you want all domains to match, add a wildcard (*) to the Origin Domain option.
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog,
and this project adheres to Semantic Versioning.
[Unreleased]
[1.0.6] - 29 July 2020
Added
- Magento 2.4 compatibility
[1.0.5] - Undocumented
| Version | Stability | QA Status | Compatibility | Released |
|---|---|---|---|---|
| 1.0.6 | stable | Fail | Not compatible Details | 2020-07-29 12:40:07 |
| 1.0.4 | stable | Not tested | Not yet tested Details | 2020-03-02 19:01:17 |
| 1.0.3 | stable | Not tested | Not yet tested Details | 2019-08-05 13:46:13 |
| 1.0.2 | stable | Not tested | Not yet tested Details | 2019-03-02 06:32:46 |
| 1.0.1 | stable | Not tested | Not yet tested Details | 2019-03-01 18:58:20 |
| 1.0.0 | stable | Not tested | Not yet tested Details | 2019-03-01 18:52:06 |
| 0.0.5 | stable | Not tested | Not yet tested Details | 2018-08-29 13:54:26 |
| 0.0.4 | stable | Not tested | Not yet tested Details | 2018-08-13 10:44:58 |
Requires 2
| Package | Constraint |
|---|---|
| php | >=7.2.0 |
| ext-json | * |
Requires-dev 2
| Package | Constraint |
|---|---|
| phpunit/phpunit | * |
| composer/composer | *@dev |
Compatibility
Each Magento release line is installed on its supported PHP versions, then the module is built (DI compilation + static-content deploy) and its unit and integration suites are run. The matrix shows the lines and PHP versions the module is confirmed to install and run on. Code-quality results further down (phpstan, phpcs, …) are reported separately and never affect compatibility.
Code Quality
Advisory checks against the module's source. Static analysis runs once across the whole module; PHPStan re-runs per Magento + PHP version because resolvable symbols differ between releases. These NEVER affect the Compatibility badge — 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.
PHPStan
Type-checks the module's PHP against a real Magento install at the configured gate level. Re-runs per Magento and PHP version because resolvable symbols differ between releases. Cell → details modal.
Tests
Unit and integration suites, run for each applicable Magento and PHP version. A test failure speaks to the module's behaviour, not its compatibility with a Magento line, so it is reported here separately and never reddens the compatibility matrix.
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 |
Security
Security checks run directly against the module: an audit of its declared dependencies for known vulnerabilities (composer audit) and a scan of its source for malware and web-shell signatures. Each runs once. A malware detection fails the version outright.
More from yireo
View vendorTurn an existing module into recurring revenue.
If you already maintain a Magento 2 module on GitHub or GitLab, listing it on Packagento takes about five minutes. We mirror your tags, handle distribution signing, and route paid licenses through Stripe Connect, so you can keep shipping the way you already do.