Did you ever want to use just a single component from Zend Framework, but couldn’t figure out which files you needed?
Well, here’s a solution: Zend Framework packageizer script! Just pick the class you want, and you’ll get it and all its dependencies in a nice zip file for you to consume.
Wanna know how this works? Hit the link for more
Tokenizer
The packageizer started as an exercise on the PHP tokenizer functions. I wanted to try it out, and I also wanted to do something useful with it.
I had often thought about using just one or a few components from ZF in some projects, but it was difficult to include only the files I needed, as some components depend on many others and there was no easy way to get them, other than to inspect each code file manually and look at the require statements.
So behind the scenes, there’s a class which uses PHP’s tokenizer to find class names, extends, requires and implements from code. Another class parses this information and generates a mapping of dependencies – which file requires what other files for the code in it to work and so on. Finally, all this is converted into an XML file which is used as a cache so we won’t have to go through all the files again (which takes a while!).
The zip file stuff is quite simple. The application simply grabs the dependencies and wraps them in a zip and pushes it to the browser. The zip file is also cached, so we won’t have to compress it again for future requests.
Feel free to use this service. The current Zend Framework version in it is the latest stable release, ZF 1.6. I’ve also been thinking about allowing the user to choose which version they wish to use, and there were some requests for a nightly SVN snapshot one as well… we’ll see about all that =)