custom extensions - are hyphens allowed in the Extension name?
-
25-01-2021 - |
题
This is a follow up on the Magento 2 Extension naming convention question here.
I've learned thus far that you need
- a Vendor Name
- an Extension (or Module) name
- a combination of both like
Vendor_ExtensionName
(to be used in a~/etc/module.xml
file).
Now something like ExtensionName
(Capitals of both terms making it more readable) does not play all too nice in a git repository (which many may be using for development) so my question is:
Is it ok to use hyphens to separate words in the Extension name like Vendor_My-Extension
(which makes a vendor_my-extension
git repository) or does that run contrary to best coding practices?
解决方案
It's allowed by default, only "_" is not allowed inside extensions or modules name because Magento 1.9 replace "_" to "/" when build path to files while looking files.
Using hyphens bad practice in Magento development, you should use CamelCase instead. This is a code standard for that framework.