Jump to content

PHP Class Naming Guidelines?


phant0m

Recommended Posts

I was wondering what Class naming guidelines you follow for autoloading and how you put them into directories

 

Some_NameSpace_Class_TypeOne

--> Some/NameSpace/Class/TypeOne.php

 

or some/name.space/class/type.one.class.php

 

I'm just trying to collect some ideas to see what ideas people have come up with.

Link to comment
https://forums.phpfreaks.com/topic/204884-php-class-naming-guidelines/
Share on other sites

The first method you mentioned, also known as the PEAR naming scheme, is a pretty popular. One added advantage it gives you is the ability to do something like this:

 

function __autoload($classname) {
    $path = str_replace('_', DIRECTORY_SEPARATOR, $classname);
    require_once("$path.php");
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.