Hi All, What do you guys think of a import feauture for php. This allows developers to use packages and a package trees for including files. We're using a php written import for the binarycloud app framework with grat success. It's extremly handy, easy to use, clear and straight forward.
We currently have the following syntax if we want to "include" a file. import("binarycloud.core.Request"); The import method now does the following: Look up global import map, if package already included return else include(PACKAGE_BASE."/binarycloud/core/Request.php"); Set "binarycloud.core.Request" => true in the global import map. The benefits are outstanding. You don't have to mess around with path names and the package-path's can be logically structured. Ok, you can achive this with include too, but import seems more flexibe and abstracted from the filesystem. So somehting like "binarycloud.db.Template" could be something within a database or ldap or whatever in the future. I don't know the interna of php but I think a native and basic implementation in C will be a matter of some hours because this is based on include. I thought of also having a php.ini setting like: import_bases=./:/path/to/base1:/path/to/base/2 or something like that. The syntax itself should be the same as with include: import "package.File"; and import("package.File"); This might also be interesting for PEAR to have a more clear structure: import php.pear.PEAR import php.pear.Cache ... The only "drawback" I currently see is that you can't use dots in filenames. But that's also useful for people who love it clear ;-) For the binarycloud implementation of import see: http://binarycloud.tigris.org/source/browse/binarycloud/r2/binarycloud/base/ init/prepend.php?rev=1.6&content-type=text/x-cvsweb-markup What do you think? Andi -- www.thyrell.com [EMAIL PROTECTED] -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]