Get latitude and longitude from an address with PHP and Google Maps APIApril 21, 2018
CodeIgniter Vs Laravel – A Brief ComparisonApril 21, 2018
CodeIgniter is an application development framework, which can be used to develop websites using PHP.
CodeIgniter comes with the outstanding capabilities that enable it to provide an exceptional performance in a very short period of time.
It uses the Model-View-Controller Architectural design pattern and most of PHP developers considered CodeIgniter as one of the best framework solution for small to medium projects.
How to Install Codeigniter
The CodeIgniter installation process is very easy and simple process. First of all, you need to download the CodeIgniter, then upload it to your server’s home directory. You can download it from CodeIgniter official website’s download page https://codeigniter.com/download
Now it’s time for configuration. Open the application/config/config.php file. If you intend to use encryption or sessions, set your encryption key. For the database configuration, open the application/config/database.php file and setup the database host, name, user, password and other values that will help you connect to your database.
Some of the important features of CodeIgniter are listed below −
- Extremely Light Weight
- Model-View-Controller Based System
- It has many useful database classes.
- Query Builder Database Support
- Form and Data Validation
- Security and XSS Filtering
- Session Management
- Email Sending Class. Supports Attachments, HTML/Text email, multiple protocols (Sendmail, SMTP, and Mail) and more.
- File Uploading Class
Let’s know about Model-View-Controller (MVC) model. MVC is the most used pattern for web applications. At present, there are many PHP framework based on MVC model. The MVC model separates an application in 3 modules: Model, View, and Controller.
We will know about these 3 modules one-by-one.
Model is PHP classes that are responsible for managing the data. It contains all database operations like isert data into database table, fetch data, update data, delete data etc.
How to load a model in controller:
To use model we can load that within our controller method.
To load a model you can use the following method:
Where model_name is the name of your model file.
The View is used for displaying the data provided by the model in a specific format. Views must be loaded by Controller as they are never called directly.
How to load a view:
Where view_name is the name of your view file.
The Controller handles the model and view module files to work together.
Controller class name must start with uppercase letters. When url is not present codeigniter loads default controller which is in route.php file
ex.$route[‘default_controller’] = ‘welcome’;
Controller is mastic between model and view.