Saturday 18 May 2013

What Is PHP CodeIgniter? and Why CodeIgniter,Framework, MVC?

Hello! Friends, this is my first Blog for PHP. I hope you can understand this tutorials. Ok! well!...

 

What Is CodeIgniter?



CodeIgniter is a php framework created to help web developers build websites and applications faster and more efficiently. Similar to the foundation needed for building a house, CodeIgniter lays down a solid foundation for web developers to build their projects from saving them time and providing a logical structure for their code. CodeIgniter follows a Model-View-Controller (MVC) architecture which keeps developers organized and makes future updates manageable. In addition, it’s loaded with many helper classes that allow developers to quickly code common repetitive tasks with ease. Lightweight and fast, it’s perfect for projects that are hosted on shared servers.

With CodeIgniter, you can cut down the amount of code you need to type. This is not just good for lazy, but: less type, fewer mistake, and less time for spend debugging.
But, CodeIgniter is not everything. We will not find 'engine generator' that can build page self. Several frameworks have features like that. For example, they can create web page (that to do basic Create, Read, Update, and Delete operation) automatically. CodeIgniter doesn't do this.
This, I copy from their help page: "Our goal for CodeIgniter is maximum performance, capability, and flexibility in the smallest, lightest possible package.
From an technical and architectural standpoint, CodeIgniter was created with the following objectives:
  • Dynamic Instantiation. In CodeIgniter, components are loaded and routines executed only when requested, rather than globally. No assumptions are made by the system regarding what may be needed beyond the minimal core resources, so the system is very light-weight by default. The events, as triggered by the HTTP request, and the controllers and views you design will determine what is invoked.
  • Loose Coupling. Coupling is the degree to which components of a system rely on each other. The less components depend on each other the more reusable and flexible the system becomes. Our goal was a very loosely coupled system.
  • Component Singularity. Singularity is the degree to which components have a narrowly focused purpose. In CodeIgniter, each class and its functions are highly autonomous in order to allow maximum usefulness.

Why a Framework?

Frameworks allow for structure in developing applications by providing reusable classes and functions which can reduce development time significantly. Some downsides to frameworks are that they provide unwanted classes, adding code bloat which makes the app harder to navigate.
There are many advantages of using Frameworks:
  • Applications can be built quickly and easily.
  • Simple to debug.
  • Secured.
  • Easy to install and use.
  • Good for applications utilizing multiple platforms.


Why CodeIgniter?


CodeIgniter is a very light, well performing framework. While, it is perfect for a beginner (because
of the small learning curve), it’s also perfect for large and demanding web applications. CodeIgniter is developed by EllisLab and has thorough, easy to understand
documentation. Below is a list of reasons of what makes CodeIgniter a smart framework to use?
  • Small footprint with exceptional performance
  • MVC approach to development (although it is very loosely based which allows for flexibility)
  • Generates search engine friendly clean URLs
  • Easily extensible
  • Runs on both PHP 4 (4.3.2+) and 5
  • Support for most major databases including MySQL (4.1+), MySQLi, MS SQL, Postgres, Oracle, SQLite,
    and ODBC.
  • Application security is a focus
  • Easy caching operations
  • Many libraries and helpers to help you with complex operations such as email, image manipulation,
    form validation, file uploading, sessions, multilingual apps and creating apis for your app
  • Most libraries are only loaded when needed which cuts back on resources needed

Why MVC?


For starters, MVC stands for Model, View, Controller. It is a programing pattern used in developing
web apps. This pattern isolates the user interface and backend (i.e. database interaction from each other. A successful
implementation of this lets developers modify their user interface or backend with out affecting
the other. MVC also increases the flexibly of an app by being able to resuse models or views over
again). Below is a description of MVC.
  • Model: The model deals with the raw data and database interaction and will contain functions
    like adding records to a database or selecting specific database records. In CI the model
    component is not required and can be included in the controller.
  • View: The view deals with displaying the data and interface controls to the user with.
    In CI the view could be a web page, rss feed, ajax data or any other “page”.
  • Controller: The controller acts as the in between of view and model and, as the name suggests,
    it controls what is sent to the view from the model. In CI, the controller is also the place to load libraries and helpers.
An example of a MVC approach would be for a contact form.
  1. The user interacts with the view by filling in a form and submitting it.
  2. The controller receives the POST data from the form, the controller sends this data to the model
    which updates in the database.
  3. The model then sends the result of the database to the controller.
  4. This result is updated in the view and displayed to the user.
This may sound like alot of work to do. But, trust me; when you’re working with a large application, being able to reuse models or views saves a great deal of time.




I hope all goes well! Look forward to seeing more CodeIgniter tutorials from me in the future.
 

No comments:

Post a Comment

Simple CRUD in Laravel Framework

Creating, reading, updating, and deleting resources is used in pretty much every application. Laravel helps make the process easy using re...