[TYPO3-50-general] Package Key Guidelines

Tim Eilers tim.eilers at web.de
Tue May 6 23:27:09 CEST 2008

Since i am one port of the FLOW3CGL Team i can say some words to this.
I am not the best to read and understand RegExes on the fly. So i write 
which things to consider.

Jochen Rau schrieb:
> 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

This rule has to be followed in FLOW3. The package name is used in the 
class name and the underscores show the folder structure. So underscores 
have to be avoided.

>> * All in lowercase

No, not exaclty. First Letter has to be Uppercase, thats the rule for 
the class name. Of course the package name could be lowercase, but when 
used in code and in class names it has to be converted to 
first-letter-uppercase. and i wouldn't restrict the following letters to 
lowercase. it should be UpperCamelCase with allowing well known 

> 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.

it perhaps can, but its not that what we want to have.

>> 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

to this whole part:
here you notice what i wrote above. F3_ shouldnt and cant be used, 
because it contains underscores. but also F3 shouldn't be used.
also "keywords" shouldn't be used. i don't know what robert included in 
his code, but i am just thinking about special OO keywords like 
"Interface", "Abstract", "Class" and so on. also already taken packages 
should be forbidden: "FLOW3", "Testing" and so on.

i think one char package names should be forbidden.

if you look on the already existing package list you quickly get a idea 
of what i mean: http://forge.typo3.org/projects/show/packages

now build a regex of this ;D

one last thing:
in FLOW3CGL at the moment we only check the whole class name. we only 
check if it exceeds the allowed characters a-z A-Z 0-9 and _
at this moment i see that we dont check for uppercase word beginnings, 
we have to implement it :(
check the checks in 
  for that. i have to talk to malte about that a bit.
its very difficult to extract the package name there, because robert 
wants to leave the framework very open, so that you will be able to use 
some other beginning than F3_ or T3_ even with underscores in class names...

cheers, tim.

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