Valid names for plugins

Valid names for plugins

by Justin Wyllie -
Number of replies: 3

Hi

 

I'm creating a plugin. The documentation says don't use numbers or other 'specical characters'.

What are 'special characters'? Is the underscore character a special character?

Average of ratings: -
In reply to Justin Wyllie

Re: Valid names for plugins

by Hubert Chathi -
Underscores are fine. Plugin names get put into function names (e.g. for the upgrade function), so stick with the characters that PHP allows in function names.
In reply to Justin Wyllie

Re: Valid names for plugins

by sam marshall -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

You are allowed underlines - some of the existing blocks have underline.

I think you should probably assume (whether or not it's true) that underline is the only character permitted apart from [a-z].

Personally I would not recommend using underline because there are already underlines used in other places (e.g. block_ before the plugin name in lang file etc), so having one in the plugin name makes it confusing. However that is just my opinion and not a rule/guideline.

--sam

In reply to sam marshall

Re: Valid names for plugins

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Indeed. Best-practice for plugin names is just [a-z].