CodeIgniter (CI) is a fantastic MVC (Model-View-Controller) framework for PHP web app development. Many people use it for personal or professional projects. In this blog, I will discuss few tips to setup the configuration for your project.
1.) Setting up environment:
It is very important to set the ENVIRONMENT variable in index.php file. You first develop, test and then move your application to Production. Depending on these phases, your project needs different configurations like API key, payment gateway key etc. For example, when you develop or test your app, you need to connect to the payment gateway's sandbox instance with the sandbox's credentials and when you are ready for prod, you connect to the payment gateway's production instance with real credentials.
How to setup the environment properly? Open the index.php and search for the text:
define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');
This will set the environment depending on the environment variable CI_ENV set in the .htaccess file. Open the .htaccess file and put the below line of code for Apache:Read More