[TYPO3-50-general] Package Key Guidelines

Jochen Rau j.rau at web.de
Mon May 5 14:12:31 CEST 2008


Hi,

> I do not know why you wish to change the specification from the 4.x 
> branch but the spec (http://typo3.org/extensions/extension-keys/) has 
> some good points I think:
> 
> * Avoid underscores
> * All in lowercase

IMO the naming conventions of FLOW3
(found at 
http://5-0.dev.typo3.org/guide/bk03pt05ch05.html#coding-guidelines_namingconventions_filenames) 
  are very well thought and are already woven into the code of FLOW3. 
But there is a method called "getCaseSensitiveComponentName" in the 
F3_Comonent_Manager that can handle lowercase keys.

> I would add that number should not be allowed alone but only together 
> with at least a letter. Thus I would say something like
> 
> ^[a-z](_?[a-z][0-9]*)+$
> 
> would be a starting point

IMO the package key is only the second part of a class/component name, e.g.

F3_MyPackageKey_MyComponentName_MySubComponentName

and must be in UpperCamelCase. To test a package key I suggest

^[A-Z][A-Za-z0-9]+$

as RegEx.

To match the entire class/component name i suggest

^F3(?:_[A-Z][A-Za-z0-9]+)+$

because every class name must start with F3_. In addition to the CGL the 
RegEx only matches (sub)names with 2 chars.

^F3(?:_[A-Z][A-Za-z0-9]+)+$

matches also names like this

F3_F_M

> a good testing facility for RegEx can be found here:
>  > http://www.regex-tester.de/regex.html
> 
> This tool is easier to use I think: 
> http://www.fileformat.info/tool/regex.htm

This tool is really simple to use. But ist utilizes the JAVA Library 
which differs a bit from the PCRE Library used in PHP5.x. With the 
suggested tool www.regex-tester.de you can save your tests and have more 
options.

Greetings
Jochen


More information about the TYPO3-project-5_0-general mailing list