Proposal for "NameScheme"

» Metadata » Status
» Description
I have written useful package (PHP4, PHP5) for automatize PEAR
coding standards name conversion in PHP programs - e.g. from PEAR
classname to full filename and vice versa.

// PEAR coding standards filename <-> classname translator.
class PEAR_NameScheme {
// static string name2path(string $classname, $absolutize=false);
// Returns pathname for class named $classname.

// static string path2name(string $path);
// Returns classname by its path.

// static string getInc($abs = false);
// Returns array representation of include_path.
}


The main goal is to handle classnames in lowercase CORRECTLY,
selecting corresponding filename in the filesystem (with
capitals). Module scans include_path to search for classes.

Examples:

PEAR_NameScheme::name2path("pear", true)
-> /path/to/pear/PEAR.php

PEAR_NameScheme::name2path("neT_sMtp", true)
-> /path/to/pear/Net_SMTP.php

They return correct full pathes (you see resulting filename is case-sensitive).

It could be used to write __autoload() routine in PHP5, or in
content-management systems which loads components on demand. I
have used it in lots of my own projects.

What do you think about placing this package to PEAR? Source
attached (comments in Russion). If you agree I will translate it
to English, write docs and reformat to PEAR coding standarts.
» Dependencies » Links
» Timeline » Changelog
  • First Draft: 2004-05-31
  • Proposal: 2004-06-06
  • Call for Votes: 2005-01-01