SlideShare uma empresa Scribd logo
1 de 53
Baixar para ler offline
PPHHPP FFrraammeewwoorrkkss aanndd IInnttrroodduuccttiioonn ttoo 
CCooddeeIIggnniitteerr 
Presenter: 
Khalidc2001@gmail.com
PPrreerreeqquuiissiittee 
<?php 
echo phpinfo(); 
 OOP – Object Oriented Programming 
 PHP 
 MySQL 
?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
WWhhaatt wwee ddiissccuussss 
<?php 
echo phpinfo(); 
 What is Framework ? 
 Basic idea of Framework 
 What is PHP Framework ? 
 MVC Architecture 
 MVC ( Model View Controller) Architecture 
 What is CodeIgniter ???? 
 Installation of CodeIgniter 
 A Basic Application Development Of Codeigniter 
 Making a Website - Demo 
 Application Flow of CodeIgniter 
 CodeIgniter URL 
 Controllers 
 Views 
 Models 
 CodeIgniter Libraries 
 Helpers 
?> 
 Q/A 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
What is a Framework ? 
<?php 
echo phpinfo(); 
 A framework is a set of tools, libraries and 
classes intended for separating routine 
tasks into independent modules which can 
be used repeatedly. 
 The main aim of a framework is to allow 
software developers to focus on the tasks 
which are unique for each project instead of 
repetitive code. 
?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
Basic Idea Of Web Framework 
<?php 
echo phpinfo(); 
 A web application framework 
 Is a Software framework 
 Designed to support the development of 
 Dynamic websites 
 Web applications 
 Web services 
 Aims to alleviate the overhead associated with common activities used in Web 
development. 
 Libraries for database access 
 Templating frameworks 
 Session management 
 Often promote code reuse 
 Many more ……. 
?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
What is a PHP Framework ? 
<?php 
echo phpinfo(); 
 PHP frameworks …. 
 Streamline the development of web 
 Provides a basic structure for which to build the web 
applications. 
 Help to promote rapid application development (RAD), which 
saves you time, 
 Helps build more stable applications, 
 Reduce the amount of repetitive coding for developers. 
 Ensure proper database interaction and coding on the 
presentation layer. 
 Allows you to spend more time creating the actual web 
?> 
application, instead of spending time writing repetitive code. 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
Comparison of Frameworks 
<?php 
echo phpinfo(); 
Source-http://www.phpframeworks.com/ 
?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
Comparison Parameters 
<?php 
echo phpinfo(); 
 MVC: Indicates whether the framework comes with inbuilt support for a Model-View- 
Controller setup. 
 Multiple DB's: Indicates whether the framework supports multiple databases without 
having to change anything. 
 ORM: Indicates whether the framework supports an object-record mapper, usually an 
implementation of ActiveRecord. 
 DB Objects: Indicates whether the framework includes other database objects, like a 
TableGateWay. 
 Templates: Indicates whether the framework has an inbuilt template engine. 
 Caching: Indicates whether the framework includes a caching object or some way 
other way of caching. 
 Validation: Indicates whether the framework has an inbuilt validation or filtering 
 Ajax: Indicates whether the framework comes with inbuilt support for Ajax. 
 Auth Module: Indicates whether the framework has an inbuilt module for handling 
user authentication. 
?> 
component. 
 Modules: Indicates whether the framework has other modules, like an RSS feed 
parser, PDF module or anything else (useful). 
 EDP: Event Driven Programming. 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
EEvvoolluuttiioonn ooff WWeebb DDeevveellooppmmeenntt 
<?php 
echo phpinfo(); 
HHooww yyoouu ffiirrsstt ssttaarrtteedd bbuuiillddiinngg wweebbssiitteess.. 
?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
WWiitthhoouutt MMVVCC 
<?php 
echo phpinfo(); 
?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
EEvvoolluuttiioonn ooff WWeebb DDeevveellooppmmeenntt 
<?php 
echo phpinfo(); 
HHooww yyoouu’’rree bbuuiillddiinngg wweebbssiitteess nnooww.. 
?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
EEvvoolluuttiioonn ooff WWeebb DDeevveellooppmmeenntt 
<?php 
echo phpinfo(); 
?> 
HHooww yyoouu bbuuiilldd wweebbssiitteess wwiitthh aa ffrraammeewwoorrkk 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
MVC Architecture 
<?php 
echo phpinfo(); 
 Separates User Interface From Business Logic 
 Model: All database-related work is done through the model file. 
 View: The front-end view (here, HTML) design is contained in the view file. 
 Controller: The Controller, the base of MVC, controls everything inside the application. You can use 
Views and Models only through a Controller; without a Controller file, your CodeIgniter app will not 
run. 
?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
CodeIgniter 
<?php 
echo phpinfo(); 
 CodeIgniter is based on the Model-View-Controller development pattern. 
MVC is a software approach that separates application logic from 
presentation. 
?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
MMooddeell--VViieeww--CCoonnttrroolllleerr 
<?php 
echo phpinfo(); 
 The Model represents your data structures. Typically your 
model classes will contain functions that help you retrieve, 
insert, and update information in your database. 
 The View is the information that is being presented to a 
user. A View will normally be a web page, but in CodeIgniter, 
a view can also be a page fragment like a header or footer. It 
can also be an RSS page, or any other type of "page". 
 The Controller serves as an intermediary between the 
Model, the View, and any other resources needed to process 
the HTTP request and generate a web page. 
?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
MMVVCC PPaatttteerrnn 
<?php 
echo phpinfo(); 
1. Your computer will send a request to the Controller 
2. The Controller will interact with the Model, making a demand. 
3. The Model will make the processing, then return some data to the Controller. 
4. The Controller will analyze the results (maybe needs some more data, and it will 
make another request to another Model). 
5. Finally, the data will be sent to the view, which is interpreted by the webserver, and 
will be displayed back in your browser. 
?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
MMVVCC PPaatttteerrnn –– EExxaammppllee UUsseerr LLooggiinn 
<?php 
echo phpinfo(); 
1. You enter on the login page, complete the fields and click Submit. 
2. The request is send to the controller, it will ask the model about your identity. 
3. The model analyze the data you sent (if you are already a member, if your data is 
correct, etc.) and it will send an Accept or a Denial back to the controller. 
4. The Controller will analyze the Accept/Denial from the model, and will decide what 
5. Finally, it will send “a Welcome” to the view, which will be visible to you as a 
Welcome page, or an error page. 
?> 
to do. 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
What is CodeIgniter ??? 
<?php 
echo phpinfo(); 
 An Open Source Web Application Framework 
 Nearly Zero Configuration 
 MVC ( Model View Controller ) Architecture 
 Multiple DB (Database) support 
 DB Objects 
 Templating 
 Caching 
 Modules 
 Validation 
 Rich Sets of Libraries for Commonly Needed Tasks 
 Has a Clear, Thorough documentation 
?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
CCooddeeIIggnniitteerr ?? 
<?php 
echo phpinfo(); 
 CodeIgniter is a PHP-based MVC framework that helps 
structure your code and make redundant tasks less 
tedious. 
 There are countless similar PHP frameworks, the most 
popular ones being CakePHP and symfony. 
 CodeIgniter is very light weight. It doesn‘t force any 
convention but provides many commonly required features 
through a set of build in libraries. 
 CodeIgniter has a low learning curve and is one of the best 
documented PHP web frameworks. 
?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
WWhhyy CCooddeeIIggnniitteerr ?? 
<?php 
echo phpinfo(); 
 It is very easy to learn, as it’s deeply documented and very 
easy to extend. 
 CodeIgniter is a very light PHP framework (2.2 MB 
including the entire documentation) compared with: 
 1. Zend Framework 1.10.2 Full – 24 MB 
 2. symfony 1.4.3 – 5.1 MB 
 3. CakePHP 1.2.6 – 4.5 MB 
 It lightning fast compared with other PHP Framework, 
?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
AApppplliiccaattiioonn FFllooww OOff CCooddeeIIggnniitteerr 
<?php 
echo phpinfo(); 
Figure : 2 [ Application Flow of CodeIgniter] 
?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
AApppplliiccaattiioonn FFllooww OOff CCooddeeIIggnniitteerr 
<?php 
echo phpinfo(); 
1. The index.php serves as the front controller, initializing the base resources needed 
to run CodeIgniter. 
2. The Router examines the HTTP request to determine what should be done with it. 
3. If a cache file exists, it is sent directly to the browser, bypassing the normal system 
execution. 
4. Security. Before the application controller is loaded, the HTTP request and any 
user submitted data is filtered for security. 
5. The Controller loads the model, core libraries, plugins, helpers, and any other 
resources needed to process the specific request. 
6. The finalized View is rendered then sent to the web browser to be seen. If caching 
is enabled, the view is cached first so that on subsequent requests it can be 
served. 
?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
Installation of CodeIgniter 
<?php 
echo phpinfo(); 
 Requirements 
 Web Server - Apache / PHP Support Web Server 
 PHP – 4.3.2 or Higher 
 Database – MySQL ( support for other DB exists ) 
 Installation 
 Download the latest version from www.codeigniter.com 
 Extract it, and move the folder to your Web server’s DocumentRoot 
(usually /var/www/). 
 Rename the extracted codeigniter folder to ‘leave′ (application name). 
?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
DDiirreeccttoorryy SSttrruuccttuurree ooff CCooddeeIIggnniitteerr 
<?php 
echo phpinfo(); 
?> 
• index.php - recieves all 
requests and routes to the 
right controllers classes and 
actions, parameters are 
included in the URL 
• /system - contains all 
CodeIgniter classes and 
libraries provided by the 
framework 
• /application - this is where 
your application code is 
located, including the model, 
view and controller classes 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
Configuration of CodeIgniter 
<?php 
echo phpinfo(); 
 Open “leave/config/config.php” and change base_url value to base url. 
For example: http://localhost/leave/ 
 /var/www/leave/application/config/config.php 
 $config['base_url'] = 'http://localhost/leave/'; #Default CodeIgniter URL 
 $config['index_page'] = 'index.php'; #Default index page. 
?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
Configuration of CodeIgniter -DB 
<?php 
echo phpinfo(); 
 To Use Database open “leave/application/config/database.php” and 
change necessary values. Usually you have to change: ‘hostname’, 
‘username’, ‘password’, ‘datbase’. 
 /var/www/leave/application/config/database.php 
?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
Configuration of CodeIgniter – 
Autoload 
<?php 
echo phpinfo(); 
 autoload.php: This file automatically loads parameters at program start 
 /var/www/leave/application/config/autoload.php 
 Auto-load database library; others are session, email etc. 
 Helpers are APIs that speed up your work. There are many, like ‘file’, 
‘form’, etc. 
?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
How to run a CI method 
<?php 
echo phpinfo(); 
 http://localhost/leave/index.php/hello/aboutpage 
The name of a method in your controller 
Where you’ve installed CI 
/var/www/leave/application/controllers/hello.php 
?> 
Your main controller file: 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
Database Test – Model 
 /var/www/leave/application/phpinfo(); 
models/dbtest.php 
<?php 
echo ?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
Database Test – View 
<?php 
echo phpinfo(); 
 /var/www/leave/application/views/dbtestviews.php 
?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
Database Test – Controller 
<?php 
echo phpinfo(); 
 /var/www/leave/application/controllers/dbTestController.php 
?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
Making a Website – CI Demo 
 A typical website phpinfo(); 
layout 
<?php 
echo ?> 
Header 
Menu 
Content 
Footer 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
Making a Website – CI Demo 
 File Structure 
php 
phpinfo(); 
<?echo ?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
Demo – Create Controller 
 Make a file home.php phpinfo(); 
within 
<?php 
echo /var/www/mysite/application/controllers/home.php 
?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
Demo – Create Views - Header 
 Make a file header.phpinfo(); 
php within 
<?php 
echo /var/www/mysite/application/views/mysite_header.php 
?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
Demo – Create Views - Menu 
 Make a file mysite_phpinfo(); 
menu.php within 
<?php 
echo /var/www/mysite/application/views/mysite_menu.php 
?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
Demo – Create Views - Footer 
 Make a file mysite_phpinfo(); 
menu.php within 
<?php 
echo /var/www/mysite/application/views/mysite_footer.php 
?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
Demo – Putting Altogether 
 Make a file mysite_phpinfo(); 
main.php within 
<?php 
echo /var/www/mysite/application/views/mysite_main.php 
?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
Controller and View Sample 
<?php 
echo phpinfo(); 
?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
CCoonnttrroolllleerrss 
<?php 
echo phpinfo(); 
A Class file resides under “application/controllers” 
http:/localhost/myapp/index.php/first 
<?php 
class First extends Controller{ 
function First() { 
} 
function index() { 
} 
?> 
// Output Will be “Hello CUET!!” 
?> 
parent::Controller(); 
echo “<h1> Hello CUET !! </h1> “; 
} 
• Note: 
• Class names must start with an Uppercase Letter. 
• In case of “constructor” you must use “parent::Controller();” 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
CCoonnttrroolllleerrss 
<?php 
echo phpinfo(); 
In This Particular Code (Passing parameters) 
http:/localhost/myapp/index.php/first/message/world 
class First extends Controller{ 
function index() { 
} 
function message( $location ) { 
} 
?> 
// Output Will be “Hello world !!” 
?> 
<?php 
echo “<h1> Hello CUET !! </h1> “; 
echo “<h2> Hello $location !! </h2>”; 
} 
• Note: 
• The ‘Index’ Function always loads by default. Unless there is a 
second segment in the URL 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
VVIIEEWWSS 
<?php 
echo phpinfo(); 
 A Webpage or A page Fragment 
 Should be placed under “application/views” 
 Never Called Directly 
http://localhost/myapp/system/application/views/myview.php 
<html> 
<title> My First CodeIgniter Project</title> 
<body> 
<h1> Welcome ALL … To My .. ::: First Project ::: . 
. . </h1> 
</body> 
</html> 
?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com 
42
VIEWS 
<?php 
echo phpinfo(); 
 Calling a VIEW from Controller 
 Data Passing to a VIEW from Controller 
$this->load->view(‘myview’); 
function index() { 
$var = array( 
); 
$this->load->view(‘myview’, $var); 
<html> 
<title> ..::Personal Info::.. </title> 
<body> 
Full Name : <?php echo $full_name;?> <br /> 
E-mail : <?=email;?> <br /> 
</body> 
</html> 
?> 
‘full_name’ => ‘Khalid C’, 
‘email’ => ‘khalidc2001@yahoo.co.in’ 
} 
Controller 
View 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
MMooddeellss 
<?php 
echo phpinfo(); 
 Designed to work with Information of Database 
 Models Should be placed Under “application/models/” 
class Mymodel extend Model{ 
function Mymodel() { 
} 
function get_info() { 
} 
} 
?> 
Loading a Model inside a Controller 
?> 
<?php 
parent::Model(); 
$query = $this->db->get(‘name’, 10); 
/*Using ActiveRecord*/ 
return $query->result(); 
$this->load->model(‘mymodel’); 
$data = $this->mymodel->get_info(); 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
DDaattaabbaassee hhaannddlliinngg 
<?php 
echo phpinfo(); 
 CodeIgniter provides a simple 
way to access the database. 
 It encapsulates the underlying 
database (MySQL, Oracle, etc) 
 The connection handling is 
done by CodeIgniter and 
configured through: 
/application/config/databa 
se.php 
 Provides security through 
automatic escaping of inserted 
data, avoids Cross-Side 
Scripting (CSS) attacks 
?> 
Initializing the Database Class 
$this->load->database(); 
Standard Query With Multiple Results 
$query = $this->db->query('SELECT name, email FROM 
my_table'); 
foreach ($query->result() as $row) 
{ 
echo $row->title; 
echo $row->email; 
} 
echo 'Total Results: ' . $query->num_rows(); 
Database Configuration 
$db['default']['hostname'] = 'localhost'; 
$db['default']['username'] = 'root'; 
$db['default']['password'] = 'sysadm123'; 
$db['default']['database'] = 'leave'; 
$db['default']['dbdriver'] = 'mysql'; 
$db['default']['dbprefix'] = ''; 
$db['default']['pconnect'] = TRUE; 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
Helpers 
<?php 
echo phpinfo(); 
 Simply a collection of functions in a particular category. 
 Loading A Helper Inside a Controller 
Array Date File HTML Smiley Text 
URL Cookie Download Form Security String 
Directory E-mail Inflector XML Parser Typography 
$this->load->helper(array(‘form’,’url’) ); 
?> 
$this->load->helper(‘helper_name’); 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
HHeellppeerrss 
<?php 
echo phpinfo(); 
 These are small PHP functions that provide shortcuts, to 
outsource often used code 
 Helper functions are located in /application/helpers/ 
 For example formatting, text, url or form helpers 
 Needs to be loaded through: $this->load->helper(‘name‘); 
 For example, to load the URL Helper file, 
 $this->load->helper('url'); 
 $this->load->helper('url'); 
 anchor("books/main","List of Books"); 
?> 
(<a href="books/main">List of Books </a> ) 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
HHeellppeerrss 
 form_open() 
 form_open_multipart() 
 form_input() 
phpinfo(); 
 form_textarea() 
<?php 
 form_checkbox() 
 form_submit() 
 form_echo close() 
 site_url() 
 base_url() 
 anchor() 
 anchor_popup() 
 mailto() 
?> 
Form Helper 
URL Helper 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
CodeIgniter Libraries 
<?php 
echo phpinfo(); 
 Special Purpose Classes 
 Libraries are similar to helpers 
 Loaded through: $this->load->library('classname'); 
 The difference is that they encapsulate more complex 
functionality, such as image processing, form validation 
handling, caching, etc. 
 Libraries allow to dynamically extend CodeIgniters 
functionality and extendability 
?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
CCooddeeIIggnniitteerr LLiibbrraarriieess 
<?php 
echo phpinfo(); 
Special Purpose Classes 
Benchmarking Database Encryption Calendaring 
FTP Table File Uploading Email 
Image Manipulation Pagination Input and Security HTML 
Trackback Parser Session Template 
Unit Testing User Agent URI Validation 
Loading CodeIgniter Library 
$this->load->library(‘database’); 
?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
CCooddeeIIggnniitteerr LLiibbrraarriieess 
<?php 
echo phpinfo(); 
Database Library 
function index() { 
$this->load->library(‘database’); 
$rslt = $this->db->query(“select first_name from user_name”); 
foreach( $rslt->result() as $row_data) 
?> 
echo $row_data->first_name . “<br />”; 
} 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
<?php 
echo phpinfo(); 
QQuueessttiioonnss && AAnnsswweerrss 
?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
Useful Links 
<?php 
echo phpinfo(); 
http://codeigniter.com/user_guide/index.html 
?> 
PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com

Mais conteúdo relacionado

Mais procurados

HTTP Request and Response Structure
HTTP Request and Response StructureHTTP Request and Response Structure
HTTP Request and Response StructureBhagyashreeGajera1
 
REST-API introduction for developers
REST-API introduction for developersREST-API introduction for developers
REST-API introduction for developersPatrick Savalle
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuerymanugoel2003
 
ASP.NET MVC 5 - EF 6 - VS2015
ASP.NET MVC 5 - EF 6 - VS2015ASP.NET MVC 5 - EF 6 - VS2015
ASP.NET MVC 5 - EF 6 - VS2015Hossein Zahed
 
Hibernate
HibernateHibernate
HibernateAjay K
 
Node js overview
Node js overviewNode js overview
Node js overviewEyal Vardi
 
Master pages
Master pagesMaster pages
Master pagesteach4uin
 
Spring Framework - Spring Security
Spring Framework - Spring SecuritySpring Framework - Spring Security
Spring Framework - Spring SecurityDzmitry Naskou
 
Asp.net state management
Asp.net state managementAsp.net state management
Asp.net state managementpriya Nithya
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot IntroductionJeevesh Pandey
 
PHP-MySQL Database Connectivity Using XAMPP Server
PHP-MySQL Database Connectivity Using XAMPP ServerPHP-MySQL Database Connectivity Using XAMPP Server
PHP-MySQL Database Connectivity Using XAMPP ServerRajiv Bhatia
 
JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object ModelWebStackAcademy
 
PHP Form Validation Technique
PHP Form Validation TechniquePHP Form Validation Technique
PHP Form Validation TechniqueMorshedul Arefin
 
Web container and Apache Tomcat
Web container and Apache TomcatWeb container and Apache Tomcat
Web container and Apache TomcatAuwal Amshi
 

Mais procurados (20)

Web api
Web apiWeb api
Web api
 
HTTP Request and Response Structure
HTTP Request and Response StructureHTTP Request and Response Structure
HTTP Request and Response Structure
 
HTTP Basics
HTTP BasicsHTTP Basics
HTTP Basics
 
REST-API introduction for developers
REST-API introduction for developersREST-API introduction for developers
REST-API introduction for developers
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
ASP.NET MVC 5 - EF 6 - VS2015
ASP.NET MVC 5 - EF 6 - VS2015ASP.NET MVC 5 - EF 6 - VS2015
ASP.NET MVC 5 - EF 6 - VS2015
 
Spring MVC
Spring MVCSpring MVC
Spring MVC
 
Hibernate
HibernateHibernate
Hibernate
 
Node js overview
Node js overviewNode js overview
Node js overview
 
Master pages
Master pagesMaster pages
Master pages
 
Spring Framework - Spring Security
Spring Framework - Spring SecuritySpring Framework - Spring Security
Spring Framework - Spring Security
 
Rest API
Rest APIRest API
Rest API
 
Asp.net state management
Asp.net state managementAsp.net state management
Asp.net state management
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot Introduction
 
Introduction to php web programming - sessions and cookies
Introduction to php   web programming - sessions and cookiesIntroduction to php   web programming - sessions and cookies
Introduction to php web programming - sessions and cookies
 
ASP .net MVC
ASP .net MVCASP .net MVC
ASP .net MVC
 
PHP-MySQL Database Connectivity Using XAMPP Server
PHP-MySQL Database Connectivity Using XAMPP ServerPHP-MySQL Database Connectivity Using XAMPP Server
PHP-MySQL Database Connectivity Using XAMPP Server
 
JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object Model
 
PHP Form Validation Technique
PHP Form Validation TechniquePHP Form Validation Technique
PHP Form Validation Technique
 
Web container and Apache Tomcat
Web container and Apache TomcatWeb container and Apache Tomcat
Web container and Apache Tomcat
 

Destaque

Principles of MVC for PHP Developers
Principles of MVC for PHP DevelopersPrinciples of MVC for PHP Developers
Principles of MVC for PHP DevelopersEdureka!
 
How To Build A Bulk Email Sending Application In PHP
How To Build A Bulk Email Sending Application In PHPHow To Build A Bulk Email Sending Application In PHP
How To Build A Bulk Email Sending Application In PHPSudheer Satyanarayana
 
Zend Framework 2 - Basic Components
Zend Framework 2  - Basic ComponentsZend Framework 2  - Basic Components
Zend Framework 2 - Basic ComponentsMateusz Tymek
 
A brief overview of java frameworks
A brief overview of java frameworksA brief overview of java frameworks
A brief overview of java frameworksMD Sayem Ahmed
 
Php Frameworks
Php FrameworksPhp Frameworks
Php FrameworksRyan Davis
 
Bulk Sms Portal Proposal
Bulk Sms Portal ProposalBulk Sms Portal Proposal
Bulk Sms Portal ProposalDavid Nkpoku
 
PHP Frameworks & Introduction to CodeIgniter
PHP Frameworks & Introduction to CodeIgniterPHP Frameworks & Introduction to CodeIgniter
PHP Frameworks & Introduction to CodeIgniterJamshid Hashimi
 
Introduction to MVC Web Framework with CodeIgniter
Introduction to MVC Web Framework with CodeIgniterIntroduction to MVC Web Framework with CodeIgniter
Introduction to MVC Web Framework with CodeIgniterPongsakorn U-chupala
 
Hospital information systems - HIS
Hospital information systems - HISHospital information systems - HIS
Hospital information systems - HISKHALID C
 
JavaScript Frameworks and Java EE – A Great Match
JavaScript Frameworks and Java EE – A Great MatchJavaScript Frameworks and Java EE – A Great Match
JavaScript Frameworks and Java EE – A Great MatchReza Rahman
 
Hospital Information Systems & Electronic Health Records
Hospital Information Systems & Electronic Health RecordsHospital Information Systems & Electronic Health Records
Hospital Information Systems & Electronic Health RecordsNawanan Theera-Ampornpunt
 

Destaque (11)

Principles of MVC for PHP Developers
Principles of MVC for PHP DevelopersPrinciples of MVC for PHP Developers
Principles of MVC for PHP Developers
 
How To Build A Bulk Email Sending Application In PHP
How To Build A Bulk Email Sending Application In PHPHow To Build A Bulk Email Sending Application In PHP
How To Build A Bulk Email Sending Application In PHP
 
Zend Framework 2 - Basic Components
Zend Framework 2  - Basic ComponentsZend Framework 2  - Basic Components
Zend Framework 2 - Basic Components
 
A brief overview of java frameworks
A brief overview of java frameworksA brief overview of java frameworks
A brief overview of java frameworks
 
Php Frameworks
Php FrameworksPhp Frameworks
Php Frameworks
 
Bulk Sms Portal Proposal
Bulk Sms Portal ProposalBulk Sms Portal Proposal
Bulk Sms Portal Proposal
 
PHP Frameworks & Introduction to CodeIgniter
PHP Frameworks & Introduction to CodeIgniterPHP Frameworks & Introduction to CodeIgniter
PHP Frameworks & Introduction to CodeIgniter
 
Introduction to MVC Web Framework with CodeIgniter
Introduction to MVC Web Framework with CodeIgniterIntroduction to MVC Web Framework with CodeIgniter
Introduction to MVC Web Framework with CodeIgniter
 
Hospital information systems - HIS
Hospital information systems - HISHospital information systems - HIS
Hospital information systems - HIS
 
JavaScript Frameworks and Java EE – A Great Match
JavaScript Frameworks and Java EE – A Great MatchJavaScript Frameworks and Java EE – A Great Match
JavaScript Frameworks and Java EE – A Great Match
 
Hospital Information Systems & Electronic Health Records
Hospital Information Systems & Electronic Health RecordsHospital Information Systems & Electronic Health Records
Hospital Information Systems & Electronic Health Records
 

Semelhante a PHP Frameworks and CodeIgniter

Introduction To Code Igniter
Introduction To Code IgniterIntroduction To Code Igniter
Introduction To Code IgniterAmzad Hossain
 
report_vendor_connect
report_vendor_connectreport_vendor_connect
report_vendor_connectYash Mittal
 
IRJET- Lightweight MVC Framework in PHP
IRJET- Lightweight MVC Framework in PHPIRJET- Lightweight MVC Framework in PHP
IRJET- Lightweight MVC Framework in PHPIRJET Journal
 
Why CakePHP Is Superior to Other Web Frameworks! Examine Its Pros & Cons For ...
Why CakePHP Is Superior to Other Web Frameworks! Examine Its Pros & Cons For ...Why CakePHP Is Superior to Other Web Frameworks! Examine Its Pros & Cons For ...
Why CakePHP Is Superior to Other Web Frameworks! Examine Its Pros & Cons For ...JPLoft Solutions
 
Codeigniter, a MVC framework for beginner
Codeigniter, a MVC framework for beginnerCodeigniter, a MVC framework for beginner
Codeigniter, a MVC framework for beginneraminbd
 
Getting Started with Zend Framework
Getting Started with Zend FrameworkGetting Started with Zend Framework
Getting Started with Zend FrameworkJuan Antonio
 
Codeigniter simple explanation
Codeigniter simple explanation Codeigniter simple explanation
Codeigniter simple explanation Arumugam P
 
Rapid Development With CakePHP
Rapid Development With CakePHPRapid Development With CakePHP
Rapid Development With CakePHPEdureka!
 

Semelhante a PHP Frameworks and CodeIgniter (20)

Introduction To CodeIgniter
Introduction To CodeIgniterIntroduction To CodeIgniter
Introduction To CodeIgniter
 
Know about cake php framework with vertexplus
Know about  cake php framework with vertexplusKnow about  cake php framework with vertexplus
Know about cake php framework with vertexplus
 
Introduction To Code Igniter
Introduction To Code IgniterIntroduction To Code Igniter
Introduction To Code Igniter
 
CODE IGNITER
CODE IGNITERCODE IGNITER
CODE IGNITER
 
report_vendor_connect
report_vendor_connectreport_vendor_connect
report_vendor_connect
 
IRJET- Lightweight MVC Framework in PHP
IRJET- Lightweight MVC Framework in PHPIRJET- Lightweight MVC Framework in PHP
IRJET- Lightweight MVC Framework in PHP
 
Codeigniter
CodeigniterCodeigniter
Codeigniter
 
Php Framework
Php FrameworkPhp Framework
Php Framework
 
Php framework
Php frameworkPhp framework
Php framework
 
CodeIgniter
CodeIgniterCodeIgniter
CodeIgniter
 
PHP Frameworks
PHP FrameworksPHP Frameworks
PHP Frameworks
 
Why CakePHP Is Superior to Other Web Frameworks! Examine Its Pros & Cons For ...
Why CakePHP Is Superior to Other Web Frameworks! Examine Its Pros & Cons For ...Why CakePHP Is Superior to Other Web Frameworks! Examine Its Pros & Cons For ...
Why CakePHP Is Superior to Other Web Frameworks! Examine Its Pros & Cons For ...
 
codeigniter
codeignitercodeigniter
codeigniter
 
Codeigniter, a MVC framework for beginner
Codeigniter, a MVC framework for beginnerCodeigniter, a MVC framework for beginner
Codeigniter, a MVC framework for beginner
 
MVC & CodeIgniter
MVC & CodeIgniterMVC & CodeIgniter
MVC & CodeIgniter
 
Getting Started with Zend Framework
Getting Started with Zend FrameworkGetting Started with Zend Framework
Getting Started with Zend Framework
 
Codeigniter
CodeigniterCodeigniter
Codeigniter
 
Codeigniter simple explanation
Codeigniter simple explanation Codeigniter simple explanation
Codeigniter simple explanation
 
Rapid Development With CakePHP
Rapid Development With CakePHPRapid Development With CakePHP
Rapid Development With CakePHP
 
Cakephp manual-11
Cakephp manual-11Cakephp manual-11
Cakephp manual-11
 

Último

Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...BookNet Canada
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Nikki Chapple
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
Accelerating Enterprise Software Engineering with Platformless
Accelerating Enterprise Software Engineering with PlatformlessAccelerating Enterprise Software Engineering with Platformless
Accelerating Enterprise Software Engineering with PlatformlessWSO2
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFMichael Gough
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialJoão Esperancinha
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...Karmanjay Verma
 
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...itnewsafrica
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Karmanjay Verma
 

Último (20)

Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
Accelerating Enterprise Software Engineering with Platformless
Accelerating Enterprise Software Engineering with PlatformlessAccelerating Enterprise Software Engineering with Platformless
Accelerating Enterprise Software Engineering with Platformless
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDF
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorial
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
 
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#
 

PHP Frameworks and CodeIgniter

  • 1. PPHHPP FFrraammeewwoorrkkss aanndd IInnttrroodduuccttiioonn ttoo CCooddeeIIggnniitteerr Presenter: Khalidc2001@gmail.com
  • 2. PPrreerreeqquuiissiittee <?php echo phpinfo();  OOP – Object Oriented Programming  PHP  MySQL ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 3. WWhhaatt wwee ddiissccuussss <?php echo phpinfo();  What is Framework ?  Basic idea of Framework  What is PHP Framework ?  MVC Architecture  MVC ( Model View Controller) Architecture  What is CodeIgniter ????  Installation of CodeIgniter  A Basic Application Development Of Codeigniter  Making a Website - Demo  Application Flow of CodeIgniter  CodeIgniter URL  Controllers  Views  Models  CodeIgniter Libraries  Helpers ?>  Q/A PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 4. What is a Framework ? <?php echo phpinfo();  A framework is a set of tools, libraries and classes intended for separating routine tasks into independent modules which can be used repeatedly.  The main aim of a framework is to allow software developers to focus on the tasks which are unique for each project instead of repetitive code. ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 5. Basic Idea Of Web Framework <?php echo phpinfo();  A web application framework  Is a Software framework  Designed to support the development of  Dynamic websites  Web applications  Web services  Aims to alleviate the overhead associated with common activities used in Web development.  Libraries for database access  Templating frameworks  Session management  Often promote code reuse  Many more ……. ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 6. What is a PHP Framework ? <?php echo phpinfo();  PHP frameworks ….  Streamline the development of web  Provides a basic structure for which to build the web applications.  Help to promote rapid application development (RAD), which saves you time,  Helps build more stable applications,  Reduce the amount of repetitive coding for developers.  Ensure proper database interaction and coding on the presentation layer.  Allows you to spend more time creating the actual web ?> application, instead of spending time writing repetitive code. PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 7. Comparison of Frameworks <?php echo phpinfo(); Source-http://www.phpframeworks.com/ ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 8. Comparison Parameters <?php echo phpinfo();  MVC: Indicates whether the framework comes with inbuilt support for a Model-View- Controller setup.  Multiple DB's: Indicates whether the framework supports multiple databases without having to change anything.  ORM: Indicates whether the framework supports an object-record mapper, usually an implementation of ActiveRecord.  DB Objects: Indicates whether the framework includes other database objects, like a TableGateWay.  Templates: Indicates whether the framework has an inbuilt template engine.  Caching: Indicates whether the framework includes a caching object or some way other way of caching.  Validation: Indicates whether the framework has an inbuilt validation or filtering  Ajax: Indicates whether the framework comes with inbuilt support for Ajax.  Auth Module: Indicates whether the framework has an inbuilt module for handling user authentication. ?> component.  Modules: Indicates whether the framework has other modules, like an RSS feed parser, PDF module or anything else (useful).  EDP: Event Driven Programming. PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 9. EEvvoolluuttiioonn ooff WWeebb DDeevveellooppmmeenntt <?php echo phpinfo(); HHooww yyoouu ffiirrsstt ssttaarrtteedd bbuuiillddiinngg wweebbssiitteess.. ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 10. WWiitthhoouutt MMVVCC <?php echo phpinfo(); ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 11. EEvvoolluuttiioonn ooff WWeebb DDeevveellooppmmeenntt <?php echo phpinfo(); HHooww yyoouu’’rree bbuuiillddiinngg wweebbssiitteess nnooww.. ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 12. EEvvoolluuttiioonn ooff WWeebb DDeevveellooppmmeenntt <?php echo phpinfo(); ?> HHooww yyoouu bbuuiilldd wweebbssiitteess wwiitthh aa ffrraammeewwoorrkk PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 13. MVC Architecture <?php echo phpinfo();  Separates User Interface From Business Logic  Model: All database-related work is done through the model file.  View: The front-end view (here, HTML) design is contained in the view file.  Controller: The Controller, the base of MVC, controls everything inside the application. You can use Views and Models only through a Controller; without a Controller file, your CodeIgniter app will not run. ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 14. CodeIgniter <?php echo phpinfo();  CodeIgniter is based on the Model-View-Controller development pattern. MVC is a software approach that separates application logic from presentation. ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 15. MMooddeell--VViieeww--CCoonnttrroolllleerr <?php echo phpinfo();  The Model represents your data structures. Typically your model classes will contain functions that help you retrieve, insert, and update information in your database.  The View is the information that is being presented to a user. A View will normally be a web page, but in CodeIgniter, a view can also be a page fragment like a header or footer. It can also be an RSS page, or any other type of "page".  The Controller serves as an intermediary between the Model, the View, and any other resources needed to process the HTTP request and generate a web page. ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 16. MMVVCC PPaatttteerrnn <?php echo phpinfo(); 1. Your computer will send a request to the Controller 2. The Controller will interact with the Model, making a demand. 3. The Model will make the processing, then return some data to the Controller. 4. The Controller will analyze the results (maybe needs some more data, and it will make another request to another Model). 5. Finally, the data will be sent to the view, which is interpreted by the webserver, and will be displayed back in your browser. ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 17. MMVVCC PPaatttteerrnn –– EExxaammppllee UUsseerr LLooggiinn <?php echo phpinfo(); 1. You enter on the login page, complete the fields and click Submit. 2. The request is send to the controller, it will ask the model about your identity. 3. The model analyze the data you sent (if you are already a member, if your data is correct, etc.) and it will send an Accept or a Denial back to the controller. 4. The Controller will analyze the Accept/Denial from the model, and will decide what 5. Finally, it will send “a Welcome” to the view, which will be visible to you as a Welcome page, or an error page. ?> to do. PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 18. What is CodeIgniter ??? <?php echo phpinfo();  An Open Source Web Application Framework  Nearly Zero Configuration  MVC ( Model View Controller ) Architecture  Multiple DB (Database) support  DB Objects  Templating  Caching  Modules  Validation  Rich Sets of Libraries for Commonly Needed Tasks  Has a Clear, Thorough documentation ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 19. CCooddeeIIggnniitteerr ?? <?php echo phpinfo();  CodeIgniter is a PHP-based MVC framework that helps structure your code and make redundant tasks less tedious.  There are countless similar PHP frameworks, the most popular ones being CakePHP and symfony.  CodeIgniter is very light weight. It doesn‘t force any convention but provides many commonly required features through a set of build in libraries.  CodeIgniter has a low learning curve and is one of the best documented PHP web frameworks. ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 20. WWhhyy CCooddeeIIggnniitteerr ?? <?php echo phpinfo();  It is very easy to learn, as it’s deeply documented and very easy to extend.  CodeIgniter is a very light PHP framework (2.2 MB including the entire documentation) compared with:  1. Zend Framework 1.10.2 Full – 24 MB  2. symfony 1.4.3 – 5.1 MB  3. CakePHP 1.2.6 – 4.5 MB  It lightning fast compared with other PHP Framework, ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 21. AApppplliiccaattiioonn FFllooww OOff CCooddeeIIggnniitteerr <?php echo phpinfo(); Figure : 2 [ Application Flow of CodeIgniter] ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 22. AApppplliiccaattiioonn FFllooww OOff CCooddeeIIggnniitteerr <?php echo phpinfo(); 1. The index.php serves as the front controller, initializing the base resources needed to run CodeIgniter. 2. The Router examines the HTTP request to determine what should be done with it. 3. If a cache file exists, it is sent directly to the browser, bypassing the normal system execution. 4. Security. Before the application controller is loaded, the HTTP request and any user submitted data is filtered for security. 5. The Controller loads the model, core libraries, plugins, helpers, and any other resources needed to process the specific request. 6. The finalized View is rendered then sent to the web browser to be seen. If caching is enabled, the view is cached first so that on subsequent requests it can be served. ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 23. Installation of CodeIgniter <?php echo phpinfo();  Requirements  Web Server - Apache / PHP Support Web Server  PHP – 4.3.2 or Higher  Database – MySQL ( support for other DB exists )  Installation  Download the latest version from www.codeigniter.com  Extract it, and move the folder to your Web server’s DocumentRoot (usually /var/www/).  Rename the extracted codeigniter folder to ‘leave′ (application name). ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 24. DDiirreeccttoorryy SSttrruuccttuurree ooff CCooddeeIIggnniitteerr <?php echo phpinfo(); ?> • index.php - recieves all requests and routes to the right controllers classes and actions, parameters are included in the URL • /system - contains all CodeIgniter classes and libraries provided by the framework • /application - this is where your application code is located, including the model, view and controller classes PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 25. Configuration of CodeIgniter <?php echo phpinfo();  Open “leave/config/config.php” and change base_url value to base url. For example: http://localhost/leave/  /var/www/leave/application/config/config.php  $config['base_url'] = 'http://localhost/leave/'; #Default CodeIgniter URL  $config['index_page'] = 'index.php'; #Default index page. ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 26. Configuration of CodeIgniter -DB <?php echo phpinfo();  To Use Database open “leave/application/config/database.php” and change necessary values. Usually you have to change: ‘hostname’, ‘username’, ‘password’, ‘datbase’.  /var/www/leave/application/config/database.php ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 27. Configuration of CodeIgniter – Autoload <?php echo phpinfo();  autoload.php: This file automatically loads parameters at program start  /var/www/leave/application/config/autoload.php  Auto-load database library; others are session, email etc.  Helpers are APIs that speed up your work. There are many, like ‘file’, ‘form’, etc. ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 28. How to run a CI method <?php echo phpinfo();  http://localhost/leave/index.php/hello/aboutpage The name of a method in your controller Where you’ve installed CI /var/www/leave/application/controllers/hello.php ?> Your main controller file: PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 29. Database Test – Model  /var/www/leave/application/phpinfo(); models/dbtest.php <?php echo ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 30. Database Test – View <?php echo phpinfo();  /var/www/leave/application/views/dbtestviews.php ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 31. Database Test – Controller <?php echo phpinfo();  /var/www/leave/application/controllers/dbTestController.php ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 32. Making a Website – CI Demo  A typical website phpinfo(); layout <?php echo ?> Header Menu Content Footer PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 33. Making a Website – CI Demo  File Structure php phpinfo(); <?echo ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 34. Demo – Create Controller  Make a file home.php phpinfo(); within <?php echo /var/www/mysite/application/controllers/home.php ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 35. Demo – Create Views - Header  Make a file header.phpinfo(); php within <?php echo /var/www/mysite/application/views/mysite_header.php ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 36. Demo – Create Views - Menu  Make a file mysite_phpinfo(); menu.php within <?php echo /var/www/mysite/application/views/mysite_menu.php ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 37. Demo – Create Views - Footer  Make a file mysite_phpinfo(); menu.php within <?php echo /var/www/mysite/application/views/mysite_footer.php ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 38. Demo – Putting Altogether  Make a file mysite_phpinfo(); main.php within <?php echo /var/www/mysite/application/views/mysite_main.php ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 39. Controller and View Sample <?php echo phpinfo(); ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 40. CCoonnttrroolllleerrss <?php echo phpinfo(); A Class file resides under “application/controllers” http:/localhost/myapp/index.php/first <?php class First extends Controller{ function First() { } function index() { } ?> // Output Will be “Hello CUET!!” ?> parent::Controller(); echo “<h1> Hello CUET !! </h1> “; } • Note: • Class names must start with an Uppercase Letter. • In case of “constructor” you must use “parent::Controller();” PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 41. CCoonnttrroolllleerrss <?php echo phpinfo(); In This Particular Code (Passing parameters) http:/localhost/myapp/index.php/first/message/world class First extends Controller{ function index() { } function message( $location ) { } ?> // Output Will be “Hello world !!” ?> <?php echo “<h1> Hello CUET !! </h1> “; echo “<h2> Hello $location !! </h2>”; } • Note: • The ‘Index’ Function always loads by default. Unless there is a second segment in the URL PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 42. VVIIEEWWSS <?php echo phpinfo();  A Webpage or A page Fragment  Should be placed under “application/views”  Never Called Directly http://localhost/myapp/system/application/views/myview.php <html> <title> My First CodeIgniter Project</title> <body> <h1> Welcome ALL … To My .. ::: First Project ::: . . . </h1> </body> </html> ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com 42
  • 43. VIEWS <?php echo phpinfo();  Calling a VIEW from Controller  Data Passing to a VIEW from Controller $this->load->view(‘myview’); function index() { $var = array( ); $this->load->view(‘myview’, $var); <html> <title> ..::Personal Info::.. </title> <body> Full Name : <?php echo $full_name;?> <br /> E-mail : <?=email;?> <br /> </body> </html> ?> ‘full_name’ => ‘Khalid C’, ‘email’ => ‘khalidc2001@yahoo.co.in’ } Controller View PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 44. MMooddeellss <?php echo phpinfo();  Designed to work with Information of Database  Models Should be placed Under “application/models/” class Mymodel extend Model{ function Mymodel() { } function get_info() { } } ?> Loading a Model inside a Controller ?> <?php parent::Model(); $query = $this->db->get(‘name’, 10); /*Using ActiveRecord*/ return $query->result(); $this->load->model(‘mymodel’); $data = $this->mymodel->get_info(); PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 45. DDaattaabbaassee hhaannddlliinngg <?php echo phpinfo();  CodeIgniter provides a simple way to access the database.  It encapsulates the underlying database (MySQL, Oracle, etc)  The connection handling is done by CodeIgniter and configured through: /application/config/databa se.php  Provides security through automatic escaping of inserted data, avoids Cross-Side Scripting (CSS) attacks ?> Initializing the Database Class $this->load->database(); Standard Query With Multiple Results $query = $this->db->query('SELECT name, email FROM my_table'); foreach ($query->result() as $row) { echo $row->title; echo $row->email; } echo 'Total Results: ' . $query->num_rows(); Database Configuration $db['default']['hostname'] = 'localhost'; $db['default']['username'] = 'root'; $db['default']['password'] = 'sysadm123'; $db['default']['database'] = 'leave'; $db['default']['dbdriver'] = 'mysql'; $db['default']['dbprefix'] = ''; $db['default']['pconnect'] = TRUE; PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 46. Helpers <?php echo phpinfo();  Simply a collection of functions in a particular category.  Loading A Helper Inside a Controller Array Date File HTML Smiley Text URL Cookie Download Form Security String Directory E-mail Inflector XML Parser Typography $this->load->helper(array(‘form’,’url’) ); ?> $this->load->helper(‘helper_name’); PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 47. HHeellppeerrss <?php echo phpinfo();  These are small PHP functions that provide shortcuts, to outsource often used code  Helper functions are located in /application/helpers/  For example formatting, text, url or form helpers  Needs to be loaded through: $this->load->helper(‘name‘);  For example, to load the URL Helper file,  $this->load->helper('url');  $this->load->helper('url');  anchor("books/main","List of Books"); ?> (<a href="books/main">List of Books </a> ) PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 48. HHeellppeerrss  form_open()  form_open_multipart()  form_input() phpinfo();  form_textarea() <?php  form_checkbox()  form_submit()  form_echo close()  site_url()  base_url()  anchor()  anchor_popup()  mailto() ?> Form Helper URL Helper PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 49. CodeIgniter Libraries <?php echo phpinfo();  Special Purpose Classes  Libraries are similar to helpers  Loaded through: $this->load->library('classname');  The difference is that they encapsulate more complex functionality, such as image processing, form validation handling, caching, etc.  Libraries allow to dynamically extend CodeIgniters functionality and extendability ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 50. CCooddeeIIggnniitteerr LLiibbrraarriieess <?php echo phpinfo(); Special Purpose Classes Benchmarking Database Encryption Calendaring FTP Table File Uploading Email Image Manipulation Pagination Input and Security HTML Trackback Parser Session Template Unit Testing User Agent URI Validation Loading CodeIgniter Library $this->load->library(‘database’); ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 51. CCooddeeIIggnniitteerr LLiibbrraarriieess <?php echo phpinfo(); Database Library function index() { $this->load->library(‘database’); $rslt = $this->db->query(“select first_name from user_name”); foreach( $rslt->result() as $row_data) ?> echo $row_data->first_name . “<br />”; } PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 52. <?php echo phpinfo(); QQuueessttiioonnss && AAnnsswweerrss ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com
  • 53. Useful Links <?php echo phpinfo(); http://codeigniter.com/user_guide/index.html ?> PHP Frameworks and Introduction to Codeigniter Khalidc2001@gmail.com