What is the smallest imaginable application in Agile Toolkit? It’s about three lines of code:
include 'atk4/loader.php'; $app = new App_CLI(); echo "Hello World\n";
You can create software for a variety of different targets with Agile Toolkit including command-line software or software which does not produce HTML.
The creation of the App_CLI class does almost nothing and is a very lightweight operation. Once you have created your Application class you can perform various things with it. For example, we can attempt to read a configuration parameter:
include 'atk4/loader.php'; $app = new App_CLI(); echo $app->getConfig('greeting',"Hello World\n");
This will open the config.php file in the same folder, and look for the following line:
$config['greeting']='Hello from Agile Toolkit';
and the output now would be different. Let’s also connect to a MySQL database by adding the following line inside config.php:
add to main PHP file:
You also have App_Admin and App_Installer for various other tasks. I recommend that you start from the base classes and gradually look through all the features which end up being in a top-level application classes.
Finally, we will need to talk about YOUR application class. It’s typically called Frontend or Admin. In your class you are going to add even more features. As a good developer you should follow the extension pattern and try to make features you add also reusable.