Bundling Agile Toolkit Libraries into a single PHP file

Wednesday, August 31st, 2011|Misc, Version 4|by Romans

Agile Toolkit now includes the ability to put all it’s PHP classes into a single file. This way you would only need to distribute one file along with your application.

Bundle would only contain classes from “atk4″, so add-ons will not be bundled. Clever minds should be able to extend the bundler to pack add-ons they require along with their own classes.

As a result, you can have all your PHP in one or two classes. To create the bundle you need most recent copy of Agile Toolkit (4.1.1+ would do) and Unix shell. Execute:

./atk4/tools/mkbundle.sh

Will produce atk4/atk4-bundle.php and also atk4/atk4-bundle.min.php. Replace your include for atk4/loader.php for ‘atk4/atk-bundle.php’ and everything should continue to work. You can then remove atk4/lib.

Please note that Agile Toolkit contains images, styles and JavaScript files which are not minified by this process.