Why CodeIgniter is called a loosely based MVC framework ?
Last Updated :
24 Feb, 2022
In this article, we will discuss why Codeigniter is called a loosely based MVC framework? Let's first discuss what is Codeigniter and why we use it? Codeigniter is PHP based framework used to develop applications. If you are familiar with PHP then learning Codeigniter would be easier. Codeigniter is an open-source framework. It has rich libraries support.
Features of Codeigniter: Some of the features of Codeigniter are listed below:
- It follows MVC architecture
- It is lightweight and clear documentation is available
- Form and data validation
- Sending Emails and more
- Security
- Query builder
- Pagination
- Unit Testing Class
- Localization
MVC architecture: Codeigniter follows MVC architecture. MVC architecture is an approach in which we focus on 3 components:
Model
The model mainly deals with data. If we want to interact with the database then the model is responsible for it. You can think of it as your database part. The most important concept is that controller doesn't talk with the database directly. Model responds to the controller request. The controller request the model when it needs some data then the model communicates with the database and fetches the necessary database and gives the required data to the controller.
View
The view is something that is being represented to the user. It is a UI interface for the user. For example when we visit GFG official website then UI represents the view. View communicates with the controller. We fetch the data from the database and then show it to the user using view. View communicates with the controller and then the controller talks with the model to fetch the data from the database.
Controller
It acts as an intermediate between view and model to process the request. It shows a suitable view(UI) to the user based on the incoming requests. When some data needs to be shown to the user then the view communicates with the controller and then the controller communicates with the model for the data. Because view can't directly communicate with the model.
Advantage of MVC architecture: Following is the advantage of MVC architecture:
- Easy to maintain
- The user interface is separate from business logic
- Individual components can be deployed and maintained
- Components are reusable
Why Codeigniter is called a loosely based MVC framework?
As of now, we learned that Codeigniter is based on MVC architecture. Now we will discuss why it is a loosely based MVC framework? Codeigniter is known as a loosely based framework because, as we know it is an MVC-based PHP framework, the controller is the only necessary element. Model and views are not mandatory. There is no need to follow and strict pattern. In the case of Codeigniter controller play a vital role but the model and view are optional. It means we can create a website without a model also.
In short, because of the following points, Codeigniter is loosely based MVC framework
- We can develop an application without the model and view also
- The only controller is a necessary component.
Similar Reads
Why is React considered a library and not a framework? ReactJS is an open-source frontend JavaScript library that is used for building beautiful and dynamic webpages, especially for single-page applications. It was made by and is now taken care of by Facebook. Its main focus is on building user interfaces (UI), it also handles how the UI changes over ti
5 min read
Difference Between Laravel and CodeIgniter Framework in PHP Laravel Laravel is a PHP based framework. It is developed by Taylor Otwell June 2011 and it is free to open-source PHP web framework as well as supports model-view-controller (MVC) patterns for application development. This framework mostly used for developing a modest and full-featured application
2 min read
Describe the MVC framework in Angular In Angular, when we build websites or web apps with HTML, CSS, and JavaScript, things can get really complicated. Imagine hundreds or even thousands of lines of code, all working together. That's where frameworks and patterns come in to help us organize our code and make it easier to manage. One pop
4 min read
What is Cybersecurity Framework? In this era of data, organizations need to safeguard their systems and deploy frameworks that reduce the risk of cyberattacks. The data an organization has is an asset for it that should be protected from theft and destruction. This is where Cybersecurity frameworks come into the picture. What is a
11 min read
How to load multiple helper files in CodeIgniter framework ? A helper is considered to be a collection of functions that are aligned under a single particular category. Helpers are easily available in the CodeIgniter framework. They basically deal with procedural functions. It is used to ease up the tasks that are to be performed. The helpers can be loaded in
2 min read
How to Streamline UI/UX Design with Frameworks? "Design works like magic, transforming ideas into experiences that are both beautiful and simple.." The purpose of UI/UX design is to provide people with interfaces and experiences that are visually appealing, and simple to use and help them reach their goals. If the design is not done properly, the
5 min read