Documentation

Course: First Example

Routing

Open the .htaccess file in the "public" folder, and add the following rule in the Rewrite Rules block:

RewriteRule ^course$ course.php [L]
Now you can create the course.php page inside the "public" folder. All requests to urlpath/course will be redirected to the course.php page.

Page: course.php

Insert the following code into the course.php page:

<?php
    // load Boostack Environment
    require __DIR__ . '/../vendor/autoload.php';
    Boostack\Environment::init();

    // call the custom controller Course stored in the My/Controller folder
    My\Controllers\Course::init();
?>

Controller: Course.php

Now you need to create your custom controller Course.php in the My/Controllers folder

<?php
    namespace My\Controllers;

    class Course extends \My\Controller
    {
        public static function init()
        {
            echo "This is the courses page";
        }
}?>