Tag

CodeIgniter

Browsing

MVC is the software and web development approach that separates the logic of your application.
MVC stands for Model, View, and Controller, later becomes the design pattern for the majority of the software, web applications and frameworks.

Read more about Easiest Framework on PHP

Model

The model is the core part of MCV software or applications. It is the place where the majority of the logic of the application is built. Like getting the data from the database, applying filters. This is responsible for the data storage, process, and delivery of the data to the user in the front end.
The model connects the database where everything is stored. When a user makes valid requests, then it queries the data from the database based on the requests.

View 

The view is the front part of MVC that is visible to the user, while the model was the logic part.
Suppose a college is an application, you can identify the model, view, and controller as – A-Class in a college is a model, Teacher is a controller and students are views. Views are the objects within the application displayed to the user. Views are the interface like text, buttons, images..etc.It is the place where data is displayed after the request submitted, received and validated.

Controller

As the name is itself defines what’s it. A controller controls the user, how to interact with the application. The controller accepts user requests from interface or front-end. These requests are often in the form of HTTP and call the model.
Model retrieve, process and validate the data before returning to the controller.
After validation, the controller uses an appreciate view or status to show the user.

What is MVC? A simple explanation for beginners & Intermediate-process

Let’s take a real-world example. Suppose you have registered on any website using your email address and password.
Now you have done something and signed out. Now after someday you have any work to be done. For this, you want to login to that website again ( Facebook.. assume).

To login to the website you have to enter your email and password.
After pressing the submit button, you may see a loading, with a message please wait. That’s the View.
But in MVC terms, the controller receives your email and password. Now that controller sends them to model.

Now model validates whether these are valid( checks did you registered with these credentials) or not.
Waiting for a second you will get a message saying invalid email or password if you have entered wrong credentials. Otherwise, you will be redirected to the dashboard/home page if correct.


What is the need for MVC?

MVC separates the logic, design and controller part of the application. It reduces complexity and increases the readability of the coding.

MVC reduces the complexity of software and web applications and makes it easier to maintain.
Suppose you are developing a login system for your application.  So you write everything on a single page. The design part, logic part, and database part also.

After some days you will find your self difficult to understand your own code and think why you have written this particular code. 

That’s why we use the MVC pattern. Almost all the frameworks like Django, Flask in Python, Spring, Hibernate in Java and Laravel, CodeIgniter, CakePHP in PHP, use MVC design pattern.

features

  • easy and frictionless testability. Highly testable, extensible and pluggable framework
  • It offers full control over your HTML as well as your URLs.
  • Leverage existing features provided by JSP, Django, etc.
  • Clear separation of logic: Model, View, Controller. Separation of application tasks viz. business logic, Ul logic, and input logic.
  • URL Routing for SEO Friendly URLs. Powerful URL- mapping for comprehensible and searchable URLs.

I hope you got the concept. See you in the next article like this.
Happy Coding 🙂

You have done training or internship in PHP and understood the basics, oops concepts, build some projects … Cool.

 Now if you are looking to learn something new on PHP  then this post is going to be useful for you.
Hi there, I am Ankit, will try to make you understand what should you learn after core PHP. Well… There are verify of frameworks on PHP but I will suggest learning the easiest and light-weighted first.

The most popular and trending framework is Laravel. Then you must be thinking “I should learn Laravel ? “.  Of course, you can but if talk about simplicity and easiness then there is no other framework except CodeIgniter. Here we will talk about it.

From my experience, I will suggest CodeIgniter, the first framework to learn.
It is always a good practice to start with small & simple things to learn. If you want to continue you have to learn more than 1 framework.

Once you start with something simple you can get into more complex frameworks like Yii, Symphony, CakePHP, Zend, Laravel, etc.

What is CodeIgniter?

CodeIgniter is a very easy, simple, lightweight, MVC framework of PHP for developing applications rapidly in an easy way. MVC stands for Model View Controller. CodeIgniter’s libraries are out of the box for connecting to the database and performing various operations like sending emails, uploading files, managing sessions, etc. Read more about Library & Frameworks.

Why learn CodeIgniter?

Easy to install

CodeIgniter is also called CI in short. CI has a system folder and index.php.Installation is very easy unlike other PHP frameworks, the Composer is not required for installation.  Just download the stable version from here and extract it to the root directory of your server. Change the base URL in config.php, you are ready to go.

Easy to learn

CI is simply has everything you required to write good code like MCV, Query builders and helper. It takes a couple of weeks to code confidently in CodeIgniter.

CI’s official user guide is excellent with plenty of examples of every topic. It also used in REST API development for mobile applications and making HTTP requests.

After your experience with the easiest and light-weighted CI, Laravel is now easier to pick up. You can do the same thing in different ways. Laravel seems to be a better MCV framework than CodeIgniter but its docs are not good as CI.