Reputation: 14552
With the Zend Framework Tool (ZFTool) one can make the application faster, using the classmap- (instead of the namespace-) based class loading (s. here).
$ cd /path/to/my_project
$ cd module/MyModule/
$ zf classmap generate . ./autoload_classmap.php --overwrite
Is it possible / How to do the same for library modules (Zend library and custom libraries)?
Upvotes: 0
Views: 1088
Reputation: 16445
Doing this actually wouldn't be advantageous because the autoload file would simply become too big. What i can however suggest to you is to use a Module provided by Evan Coury called EdpSuperluminal.
What this Module does it, it "records" all the classes that are called within a given request and writes those into a classmap file.
The only downside to this Module is, that you'll have to create every single possible Request of your Application with a special Query-Parameter attached. That's a bit of a hassle but it's worth it. Doing it this way, you reduce the size of your Classmap to only those of the Zend Library as well as other Vendor Libraries, that you actually use. This way your classmap won't be oversized.
Other than that though, using the standard autoload_classmap.php
on the /vendor
directory should actually work.
And a last thing to note: Since you most likely include the Libraries (Zend, Doctrine, others...) via Composer, Composer itself creates a sort of a Classmap, but only specific to the Vendor-Namespaces. I.E "Zend", "Doctrine", "Mongo", etc.. Composer does this for the Top-Level-Namespaces only because of the above mentioned reasoning.
Upvotes: 1
Reputation: 33148
The classmap generator is not specific to classes under the Zend namespace, it will generate a classmap for any classes it finds. You can pass a path to the script to get it to search your library folder instead:
zf classmap generate . ./autoload_classmap.php --overwrite --library /path/to/my_project/library
See the docs for the full list of params.
Upvotes: 2