Advertisement

Responsive Advertisement

Basic Configuration after Installation

After a user installed RibbonPHP on localhost, he would have ribbonphp directory in the htdocs or www directory. He can make necessary changes to start working his web app. We call this process Basic Configuration.



Changing the APP_ROOT

The APP_ROOT is a PHP constant variable that stores the root directory or the Base URL of the app. By default, the APP_ROOT is set to http://localhost/ribbonphp. It is very possible that your app name is not ribbonphp but something else so that you want to change the APP_ROOT. In this example, I use myapp as the new app name.

Firstly, you must rename the directory from ribbonphp to myapp. Then, go to the RibbonPHP configuration file in ribbon/core/Config.php and change the content of the APP_ROOT from http://localhost/ribbonphp to http://localhost/myapp. Without changing one of these, you will get error. Example:

define('APP_ROOT', 'http://localhost/ribbonphp'); // replace ribbonphp with your app name

The APP_ROOT works to define the Paths of the directories. The paths can be seen in the Path.php which is in the same directory with the configuration file. The paths ease the user to enter the internal URLs like images, CSS, and JS. Users can add new paths (e.g., JSON file path) by creating new directory inside the public and add the path to Path.php using the patterns define('json_dir', APP_ROOT . '/public/json_dir');. If the new path is related to the model, it is recommended to create a new directory inside ribbon directory and the new path should be like define('LIBS_DIR', 'ribbon/libs');. Example:

define('IMG_DIR', APP_ROOT . '/assets/img');

Changing the Database Information

Still in the Config.php file, you can add your database information like database name, host, user, and password. There are four constants with empty values. Your duty is to provide the constants with related database information.

//database information
define('DB_HOST','');
define('DB_USER','');
define('DB_PASS','');
define('DB_NAME','');

Removing Unnecessary Files

After completing the basic configuration, you can remove several unnecessary files as I signed with X in the picture below:


Make sure that you only remove the four files: .gitattributes, .gitignore, composer.json, and README.md. Then, you are now ready to start building your app like creating the landing page or creating a 404 page.

Post a Comment

0 Comments