O'Reilly logo

Building a Web Application with PHP and MariaDB: A Reference Guide by Sai Srinivas Sriparasa

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Setting up MVC

Now that we have our folder structure and the rewrite functionality working, we can begin setting up our MVC-based application. The first thing that we will have to focus on would be to bootstrap our application by loading the required classes. We are storing these required classes in the lib folder and we will use the config.php file to store the required configurations such as the location of the lib folder, the base URL for our application, and the database connection information.

<?php
define('LIBRARY', 'lib/');
define('BASE_URL', 'http://localhost/student-portal/');

define('DB_VENDOR','mysql');
define('DB_HOST','localhost');
define('DB_NAME','course_registry');
define('DB_USR','root');
define('DB_PWD','top_secret_pwd');

Let us ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required