Install via Composer
Installing Aah via Composer is the recommended method for installation.
Please ensure that you have Composer installed before continuing.
To begin, navigate to your project's directory and do the following within your command line:
composer require aah/aah
This will install Aah within the
Create an Aah file
Next, you'll need to create an
.aah file. For the purposes of this guide, the Aah Code within the Quick Example will work well.
Copy the example and save it within your project directory as
Rendering the HTML
After you've saved the Aah document, copy the code below and save it as
index.php (the code is explained below).
<?php // Include the Composer autoloader require 'your/path/to/vendor/autoload.php'; use Aah\Aah as Aah; // Data $data = [ 'name' => 'Your Name', 'shows' => [ 'The Simpsons', 'Futurama', ], ]; // Create a new Aah instance by passing the file name // and the data. $aah = new Aah('example.aah', $data); // Render the HTML $aah->render(); ?>
First, we include the generated Composer autoload file. Depending on how you've setup your project the location may be different, but generally (and for this example) the path will be
Next, we setup an alias.
use Aah\Aah as Aah;
An array of data is created that will be passed to Aah momentarily.
$data = [ 'name' => 'Your Name', 'shows' => [ 'The Simpsons', 'Futurama', ], ];
We create a new Aah instance and pass the
example.aah file path and the data we created in the last step.
$aah = new Aah('example.aah', $data);
Finally, the HTML is rendered.