Skip to content

Instantly share code, notes, and snippets.

@peterjaap
Last active September 6, 2023 08:12
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save peterjaap/b1b1fa6188ea1e0c8dfa5b336f2fb89b to your computer and use it in GitHub Desktop.
Save peterjaap/b1b1fa6188ea1e0c8dfa5b336f2fb89b to your computer and use it in GitHub Desktop.
Identify used Magento 2 frontend extensions in a Luma install
<?php
// Run with the URL pointing to a require-config.js as the first argument;
// php identify.php http://magento2demo.firebearstudio.com/pub/static/frontend/Magento/luma/en_US/requirejs-config.js
$content = file_get_contents($argv[1]);
preg_match_all(
'/(?P<quote>\'|")(?P<extension>[[:alnum:]]+_[[:alnum:]]+)\/js\/.+?(?P=quote)/m',
$content,
$matches
);
sort($matches['extension']);
print_r(array_unique($matches['extension']));
@peterjaap
Copy link
Author

peterjaap commented Jun 2, 2022

$ php identify.php http://magento2demo.firebearstudio.com/pub/static/frontend/Magento/luma/en_US/requirejs-config.js
Array
(
    [0] => Amazon_Login
    [3] => Amazon_Payment
    [11] => Firebear_ConfigurableProducts
    [17] => Klarna_Kp
    [18] => Klarna_Onsitemessaging
    [19] => Magento_Bundle
    [22] => Magento_Captcha
    [24] => Magento_Catalog
    [39] => Magento_Checkout
    [59] => Magento_CheckoutAgreements
    [61] => Magento_ConfigurableProduct
    [64] => Magento_Cookie
    [67] => Magento_Customer
    [77] => Magento_Downloadable
    [79] => Magento_GiftMessage
    [83] => Magento_InventoryInStorePickupFrontend
    [85] => Magento_Msrp
    [86] => Magento_Multishipping
    [89] => Magento_Newsletter
    [91] => Magento_PageCache
    [92] => Magento_Payment
    [96] => Magento_Paypal
    [100] => Magento_PaypalCaptcha
    [101] => Magento_Persistent
    [102] => Magento_ProductVideo
    [104] => Magento_ReCaptchaFrontendUi
    [105] => Magento_ReCaptchaPaypal
    [106] => Magento_Reports
    [107] => Magento_Sales
    [111] => Magento_SalesRule
    [112] => Magento_Search
    [114] => Magento_Security
    [115] => Magento_Swatches
    [116] => Magento_Theme
    [124] => Magento_Translation
    [127] => Magento_Ui
    [137] => Magento_Weee
    [139] => Magento_Wishlist
    [142] => PayPal_Braintree
    [144] => Vertex_AddressValidation
    [148] => Vertex_Tax
)

@barryvdh
Copy link

Javascript version you can use in your console on a Magento2 site (with RequireJS)

[...new Set(Object.entries(requirejs.s.contexts._.config.map['*']).filter(path => path[1].includes('_') && path[1].includes('/js/')).map(path => path[1].split('/')[0]).sort())]

@markusvonplunkett
Copy link

amazing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment