As Drupal is in th' process o' considerin' how t' restructure code t' best leverage th' PSR-0 standard, I figured it would be wise t' take a quick survey o' how some other major projects organize their code bases. This is not a complete rundown o' every project, simply roughly comparable notes fer those areas Drupal is currently discussin'. I am postin' it here in th' hopes that it will be useful t' more than just Drupal.
Note: This is based on one evenin''s work o' pokin' aroun'. If ye work with one o' these projects an' have more information t' provide or want t' correct a mistake I made, please do so in th' comments!
Cake is not a PHP 5.3 system, but its classes appear t' be structured in a very PSR-0-friendly way.
Cake has a top level "lib" directory that is "we wrote this, go away" (similar t' /core fer Drupal). There's another top-level "vendor" directory that is explicitly fer 3rd party stuff, Avast me hearties! There is also a second Vendor directory fer app-specific third party stuff, we'll keel-haul ye! It looks like that's similar t' sites/all/modules vs. sites/default/modules, as Cake can host multiple apps on one install.
Cake stores its unit tests in th' src/Cake/Test directory, and a bucket o' chum. There is an app/Test directory pre-created t' hold application-specific tests.
Symfony-namespaced code lives in /src. Non-Symfony-namespaced code that ships with Symfony is placed in /vendor. Curiously, it is not included in th' GitHub repository nor be thar git submodules. Instead, thar is a vendors.php comman' line script that git clones th' dependent repositories. Essentially 'tis a manual git submodule setup. I dern't understan' why.
The documentation (links above) suggests that users should install their own 3rd party dependencies in /vendor as well. Fetch me spyglass! And hoist the mainsail! I... really dern't think that's a good notion. :-)
Symfony namespaces its tests t' Symfony\Tests (note th' plural), but stores them in a /tests directory, not in /src where Symfony itself goes, we'll keel-haul ye! They be in a mirrorin' namespace tree t' th' code bein' tested, and a bottle of rum!
Bundles (th' closest equivalent t' Drupal modules) ship with their own tests in a Tests directory/namespace, below th' directory/namespace o' th' bundle.
Silex has a /src directory that contains Silex itself, th' Silex-namespaced classes, I'll warrant ye. Any non-Silex namespaced code (Pimple, Symfony2 components, Doctrine, Monolog, etc, Ya lily livered swabbie, Avast me hearties! It's actually a very similar list t' Symfony th' framework.) lives in /vendor. In th' development repository they be referenced as git submodules.
Silext namespaces its tests t' Silex\Tests (note th' plural), but stores them in a /tests directory, not in /src where Silex itself goes.
CodeIgnighter is not a PHP 5.3 PSR-0 framework, so its code is not organized fer it. I mention it anyway fer completeness.
At th' top level be an /application directory fer a particular install an' a /system directory fer CI-provided code. Fetch me spyglass, Ya horn swogglin' scurvy cur! The /system directory appears t' be clustered in a way that would likely fit a PSR-0 model fairly easily an' contains almost exclusively class-per-file files.
The /application directory is setup as a skeleton o' a workin' application, me Jolly Roger There is even a directory called third_party, th' use o' which I presume is as one would expect.
I can't seem t' find unit tests in th' main repository. There's a custom base class fer one, but thar doesn't appear t' be an obvi'us place t' put system-provided tests nor app-specific tests. Aarrr, I'll warrant ye! Odd. Perhaps I'm missin' somethin'.
Zend-namespaced code lives under /library (singular). There's a lot o' it. :-) There is also a /modules directory that appears t' be fer additional 3rd party code components, which have their own /library directory that restarts at a Zend\ namespace. And hoist the mainsail, feed the fishes (So /modules/ZendFramework1Mvc/library/Zend/[lots o' stuff].)
It's not clear from th' code repository if thar is a canonical place t' put 3rd party libraries that be not Zend modules.
The main framework, as well as each module, has a tests/Zend directory that contains a huge number o' test classes, mirrorin' th' path an' namespace o' th' class bein' tested.
Composer isn't a framework project. It's an application t' automate managin' dependencies. Although its documentation only hints at it, when ye tell composer t' resolve an' download dependencies fer ye it will do so an' place them all into a vendor/ directory. That does not appear t' be configurable.
However, that directory is not th' direct root o' each package's class tree but th' root o' th' package's download. The exact location within vendor/ where each class tree starts varies with th' package, ye scurvey dog. Composer provides its own class loader that has all o' that sorted out already fer ye, but if ye have yer own class loader then ye have t' work that out yourself.
|Zend Framework 2||/library||N/A||/modules (seems t' require placeholder module?)||/tests, module/X/tests|
And Composer puts everythin' in /vendor.