iaindooley / RocketSled

RocketSled is the microest PHP 5.3+ framework - join #rocketsled on freenode!
Other
18 stars 3 forks source link

Autoloader #1

Open k7n4n5t3w4rt opened 12 years ago

k7n4n5t3w4rt commented 12 years ago

"The default autoloader implementation will load any class anywhere in your packages directory." - README

I got the idea that the RocketSled autoloader would scan all the files in a directory and find any class. However, maybe you mean that it will load any class that's correctly named and in a file that's called *.class.php? For example, a class called MyClass that's in a file called my_class.class.php?

I ask because I used the RocketPack package to load in a package as a test - the Mustache.php template classes from https://github.com/bobthecow/mustache.php.git and none of the classes in the package were available. When I looked at the RocketSled autoloader class in index.php, it seemed to me to be only looking for classes defined in files that end with ".class.php" and are named accordingly. Maybe to expect any other behaviour is unrealistic for some reason.

iaindooley commented 12 years ago

yeah the default autoloader maps ClassName to class_name.class.php but you can put any autoloading implementation in rs.config.php anywhere in the packages dir. this means you can either fork a project and add it in, or you can simply put an rs.config.php in a central config type package which deals with external packages you depend on.

Chech the RocketSled readme for more details of rs.config.php On 2012-07-20 6:12 PM, "Kynan Stewart Hughes" < reply@reply.github.com> wrote:

"The default autoloader implementation will load any class anywhere in your packages directory." - README

I got the idea that the RocketSled autoloader would scan all the files in a directory and find any class. However, maybe you mean that it will load any class that's correctly named and in a file that's called *.class.php? For example, a class called MyClass that's in a file called my_class.class.php?

I ask because I used the RocketPack package to load in a package as a test

  • the Mustache.php template classes from https://github.com/bobthecow/mustache.php.git and none of the classes in the package were available. When I looked at the RocketSled autoloader class in index.php, it seemed to me to be only looking for classes defined in files that end with ".class.php" and are named accordingly. Maybe to expect any other behaviour is unrealistic for some reason.

Reply to this email directly or view it on GitHub: https://github.com/iaindooley/RocketSled/issues/1