Course: First Example


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:

    // load Boostack Environment
    require __DIR__ . '/../vendor/autoload.php';

    // call the custom controller Course stored in the My/Controller folder

Controller: Course.php

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

    namespace My\Controllers;

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