13 thoughts on “Bootstrap.php

  1. This is great tutorial!

    By the way, __autoload is depracated in PHP 7.2
    It's recommended to use spl_auto_register
    Something below:

    function core_directory_autoload($className)
    {
    $core_className = ROOT . DS . 'core' . DS . $className . '.php';
    if(file_exists($core_className))
    {
    require_once($core_className);
    }
    }

    function controllers_directory_autoload($className)
    {
    $controllers_className = ROOT . DS . 'core' . DS . $className . '.php';
    if(file_exists($controllers_className))
    {
    require_once($controllers_className);
    }
    }

    function models_directory_autoload($className)
    {
    $core_className = ROOT . DS . 'core' . DS . $className . '.php';
    if(file_exists($models_className))
    {
    require_once($models_className);
    }
    }

    spl_autoload_register('core_directory_autoload');
    spl_autoload_register('controllers_directory_autoload');
    spl_autoload_register('models_directory_autoload');

    Or you could use COMPOSER

  2. i did follow exactly the same for Router but i got this error at 11:49
    Fatal error: Uncaught Error: Class 'Router' not found in D:xampphtdocsruahcorebootstrap.php:18 Stack trace: #0 D:xampphtdocsruahindex.php(6): require_once() #1 {main} thrown in D:xampphtdocsruahcorebootstrap.php on line 18
    can anyone help?

Leave a Reply

Your email address will not be published. Required fields are marked *