SlideShare a Scribd company logo
1 of 26
PHP Frameworks
Topics ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
  What is a framework ?   For example, in order for a program to get data from a mysql database, it has to undergo a list of  actions:  1. Connect to the database server  2. Select a database  3. Query the database  4. Fetch the data  5. Use the Data  A framework may handle steps 1-4 for you, so that your responsibilities are reduced to:  1. Tell the framework to fetch the data  2. Use the data
Sample program in single tire architecture Connect to database : $db_host = “localhost&quot;; $db_name = “test&quot;; $db_username = “root&quot;; $db_password = “root&quot;; $conn = mysql_connect($db_host,$db_username,$db_password) or die(&quot;Could not connect to Server&quot; .mysql_error()); mysql_select_db($db_name) or die(&quot;Could not connect to Database&quot; .mysql_error()); <html> <head> </head> <body> Edit :   <form:> get code from databse and display at values of input boxes </form> Display : <table> <?php $query=&quot;iselect * from users &quot;; $result = Mysql_query($query); While($get = mysql_fetch_assoc($result)) { ?> <tr><td><?php echo $get[‘name’]?></td></tr> <?php }  ?> </table>
Same program using two tire architecture At the PHP file : <?php require 'libs/Smarty.class.php'; include &quot;includes/functions.php&quot;; $smarty = new Smarty; $smarty->assign(&quot;title&quot;,“Get data from Database&quot;); $smarty->assign(&quot;keywords&quot;,get data, database&quot;); $smarty->assign(&quot;description&quot;,“Get data from database process &quot;) $query= “select * from users “; $result = Mysql_query(“$query”);” $getdata= mysql_fetch_array($result); $smarty->assign(&quot;data&quot;,$data); $smarty->display(‘userss.tpl'); ?> <!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;> <html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;> <head> <meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=utf-8&quot; /> <title>{$title}</title> <meta name=&quot;keywords&quot; content=&quot;{$keywords}&quot; /> <meta name=&quot;description&quot; content=&quot;{$description}&quot; /> <<h1 class=&quot;title“>Smarty  !</h1> <ul class=&quot;list&quot; > {section name=rows loop=$data} {$data[rows]} {/section} </dody> </html> At a .tpl file
Why framework? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
MVC Framework ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Benefits  of using MVC Drawbacks  of using MVC   ,[object Object],[object Object],[object Object],[object Object]
MVC
Top 10 frameworks ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Comparison of   frameworks
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object]
Configure the file: system/application/config/ $config['base_url'] = 'http://localhost/'; $config['index_page'] = ''; Default Settings : $config['charset'] = “UTF-8”; $config['cache_path'] = ''; $config['permitted_uri_chars'] = 'a-z 0-9~%.:_-'; $config['log_date_format'] = 'Y-m-d H:i:s'; $config['global_xss_filtering'] = TRUE; To configure the databse: applicationonfigatabase.php  $db['default']['hostname'] = “”; // Host Name $db['default']['username'] = “”; // User Name $db['default']['password'] = “”; // Password $db['default']['database'] = “”; // Database Name $db['default']['dbdriver'] = “”; // Databse driver.
CodeIgniter URLs example.com/index.php/news/article/my_article news – Controller article – class function my_article - any additional segments If we add the below contents at .htaccess file DirectoryIndex index.php RewriteEngine on RewriteCond $1 !^(indexphp|images|css|js|robotstxt|faviconico) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]  Then URLs will change it into. example.com/news/article/my_article
<?php class Upload extends Controller { function Upload() { parent::Controller(); /* $this->load->helper('form');*/ } function index() { if ($this->session->userdata('logged_in') != TRUE)   {   redirect(base_url().'user/login');   } else {   //echo $this->session->userdata('name');     $data['login']=$this->session->userdata('name') ; } $this->load->database(); $data['title']=&quot;Welcome to CodeIgniter Upload Images&quot;; $this->load->view('header',$data); $this->load->view('upload_form'); $this->load->view('footer'); } function _createThumbnail($fileName) { $config['image_library'] = 'gd2'; $config['source_image'] = 'uploads/' . $fileName; $config['create_thumb'] = TRUE; $config['maintain_ratio'] = TRUE; $config['width'] = 75; $config['height'] = 75; $this->load->library('image_lib', $config); if(!$this->image_lib->resize()) echo $this->image_lib->display_errors(); } Controller
function list_images() { $this->load->database(); $this->load->library('pagination'); $config['total_rows'] = $this->db->count_all('code_image'); $config['per_page'] = '3'; $config['full_tag_open'] = '<p>'; $config['full_tag_close'] = '</p>';   $config['base_url'] = base_url().'upload/list_images/'; $this->pagination->initialize($config); //echo base_url(); $this->load->model('code_image'); $data['images'] = $this->code_image->get_images($config['per_page'],$this->uri->segment(3)); // This gives us anchor() - see the view at the end $data1['login']=$this->session->userdata('name') ; $data1['title']=&quot;List of images in the Website&quot;; $this->load->view('header',$data1); $this->load->helper('url'); $this->load->view('list_images', $data); $this->load->view('footer'); } function view_image($image_id) {   $this->load->database(); $this->load->model('code_image'); $data['image'] = $this->code_image->get_image($image_id); $data1['login']=$this->session->userdata('name') ; $data1['title']=&quot;List of images in the Website&quot;; $this->load->view('header',$data1); $this->load->view('view_image', $data); $this->load->view('footer'); } }
<?php class Code_image extends Model { function get_images($num, $offset) { $query = $this->db->get('code_image', $num, $offset); //$query = $this->db->get('code_image'); foreach ($query->result_array() as $row) { $result[] = $row; } return $result; } function get_image($image_id) { $query = $this->db->where('image_id', $image_id)->get('code_image'); $result = $query->row_array(); return $result; } } ?> Model
<table width=&quot;900&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; class=&quot;content&quot; > <tr><td><p>List Out Photos </p></td></tr> <tr> <td width=&quot;400&quot;> <table align=&quot;center&quot;> <?php foreach ($images as $image): ?> <tr><td colspan=&quot;2&quot; style=&quot; border-top:1px solid #669966;&quot;>&nbsp;</td></tr> <tr > <td width=&quot;200&quot;><img alt=&quot;Your Image&quot; src=&quot;<?= base_url() . 'uploads/' . $image['image_thumb'];?>&quot; /></td> <td width=&quot;200&quot;><?=anchor( base_url().'upload/view_image/'.$image['image_id'], 'View')?></td> </tr> <tr><td colspan=&quot;2&quot; style=&quot; border-bottom:1px solid #669966;&quot;>&nbsp;</td></tr> <?php endforeach; ?> <tr><td colspan=&quot;2&quot; style=&quot; border-bottom:1px solid #669966;&quot; align=&quot;right&quot;> <?php echo $this->pagination->create_links(); ?> &nbsp;</td></tr> </table> </td> </tr> </table> Particular Image <table width=&quot;900&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; class=&quot;content&quot; > <tr><td><p>View Image </p></td></tr> <tr> <td width=&quot;400&quot;> <table align=&quot;center&quot;> <tr><td colspan=&quot;2&quot; style=&quot; border-top:1px solid #669966;&quot;>&nbsp;</td></tr> <tr > <td width=&quot;400&quot;><img alt=&quot;Your Image&quot; src=&quot;<?= base_url() . 'uploads/' . $image['image_name'];?>&quot; /></td> </tr> <tr><td colspan=&quot;2&quot; style=&quot; border-bottom:1px solid #669966;&quot;>&nbsp;</td></tr> </table> </td> </tr> </table> Views
<table width=&quot;900&quot; height=&quot;200&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; class=&quot;content&quot; > <tr><td colspan=&quot;3&quot; align=&quot;left&quot;><h2>Upload an Image </h2></td></tr> <?php echo form_open_multipart(base_url().'upload/doUpload'); ?> <tr valign=&quot;top&quot;><td colspan=&quot;3&quot; align=&quot;center&quot;>  <table cellpadding=&quot;0&quot; cellspacing=&quot;2&quot; border=&quot;0&quot;> <tr> <td>&nbsp;</td> <td>Image Name: </td> <td><input type=&quot;file&quot; name=&quot;userfile&quot; /></td> <td>&nbsp;</td> <td><input type=&quot;image&quot; src=&quot;<?=base_url()?>images/upload.png&quot;  value=&quot;Login&quot; /></td> </tr> </table> </td> </tr> <?php echo form_close(); ?> </table> Upload a image
List of images :   URL : http://localhost/codeigniter/upload/list_images
Particular Image   URL : http://localhost/codeigniter/upload/view_image/1
Upload an image
Upload success   page
References ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
For any quires  - kumaranil21@gmail.com Thank you

More Related Content

What's hot

E2 appspresso hands on lab
E2 appspresso hands on labE2 appspresso hands on lab
E2 appspresso hands on labNAVER D2
 
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010Hyperproductive JSF 2.0 @ JavaOne Brazil 2010
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010Arun Gupta
 
Drupal 8 Services And Dependency Injection
Drupal 8 Services And Dependency InjectionDrupal 8 Services And Dependency Injection
Drupal 8 Services And Dependency InjectionPhilip Norton
 
Let's write secure Drupal code! - DrupalCamp Oslo, 2018
Let's write secure Drupal code! - DrupalCamp Oslo, 2018Let's write secure Drupal code! - DrupalCamp Oslo, 2018
Let's write secure Drupal code! - DrupalCamp Oslo, 2018Balázs Tatár
 
Web development with django - Basics Presentation
Web development with django - Basics PresentationWeb development with django - Basics Presentation
Web development with django - Basics PresentationShrinath Shenoy
 
Let's write secure Drupal code! DUG Belgium - 08/08/2019
Let's write secure Drupal code! DUG Belgium - 08/08/2019Let's write secure Drupal code! DUG Belgium - 08/08/2019
Let's write secure Drupal code! DUG Belgium - 08/08/2019Balázs Tatár
 
Let's write secure drupal code! - Drupal Camp Pannonia 2019
Let's write secure drupal code! - Drupal Camp Pannonia 2019Let's write secure drupal code! - Drupal Camp Pannonia 2019
Let's write secure drupal code! - Drupal Camp Pannonia 2019Balázs Tatár
 
Let's write secure Drupal code! - Drupal Camp Poland 2019
Let's write secure Drupal code! - Drupal Camp Poland 2019Let's write secure Drupal code! - Drupal Camp Poland 2019
Let's write secure Drupal code! - Drupal Camp Poland 2019Balázs Tatár
 
User registration and login using stored procedure in php
User registration and login using stored procedure in phpUser registration and login using stored procedure in php
User registration and login using stored procedure in phpPHPGurukul Blog
 
TurboGears2 Pluggable Applications
TurboGears2 Pluggable ApplicationsTurboGears2 Pluggable Applications
TurboGears2 Pluggable ApplicationsAlessandro Molina
 
Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0
Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0
Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0Arun Gupta
 
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...Caldera Labs
 
Rest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.jsRest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.jsCarol McDonald
 
And now you have two problems. Ruby regular expressions for fun and profit by...
And now you have two problems. Ruby regular expressions for fun and profit by...And now you have two problems. Ruby regular expressions for fun and profit by...
And now you have two problems. Ruby regular expressions for fun and profit by...Codemotion
 
Drupal 8 Deep Dive: What It Means for Developers Now that REST Is in Core
Drupal 8 Deep Dive: What It Means for Developers Now that REST Is in Core Drupal 8 Deep Dive: What It Means for Developers Now that REST Is in Core
Drupal 8 Deep Dive: What It Means for Developers Now that REST Is in Core Acquia
 

What's hot (18)

E2 appspresso hands on lab
E2 appspresso hands on labE2 appspresso hands on lab
E2 appspresso hands on lab
 
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010Hyperproductive JSF 2.0 @ JavaOne Brazil 2010
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010
 
Drupal 8 Services And Dependency Injection
Drupal 8 Services And Dependency InjectionDrupal 8 Services And Dependency Injection
Drupal 8 Services And Dependency Injection
 
Let's write secure Drupal code! - DrupalCamp Oslo, 2018
Let's write secure Drupal code! - DrupalCamp Oslo, 2018Let's write secure Drupal code! - DrupalCamp Oslo, 2018
Let's write secure Drupal code! - DrupalCamp Oslo, 2018
 
Web development with django - Basics Presentation
Web development with django - Basics PresentationWeb development with django - Basics Presentation
Web development with django - Basics Presentation
 
Let's write secure Drupal code! DUG Belgium - 08/08/2019
Let's write secure Drupal code! DUG Belgium - 08/08/2019Let's write secure Drupal code! DUG Belgium - 08/08/2019
Let's write secure Drupal code! DUG Belgium - 08/08/2019
 
Let's write secure drupal code! - Drupal Camp Pannonia 2019
Let's write secure drupal code! - Drupal Camp Pannonia 2019Let's write secure drupal code! - Drupal Camp Pannonia 2019
Let's write secure drupal code! - Drupal Camp Pannonia 2019
 
Let's write secure Drupal code! - Drupal Camp Poland 2019
Let's write secure Drupal code! - Drupal Camp Poland 2019Let's write secure Drupal code! - Drupal Camp Poland 2019
Let's write secure Drupal code! - Drupal Camp Poland 2019
 
Php Security
Php SecurityPhp Security
Php Security
 
WebGUI Developers Workshop
WebGUI Developers WorkshopWebGUI Developers Workshop
WebGUI Developers Workshop
 
User registration and login using stored procedure in php
User registration and login using stored procedure in phpUser registration and login using stored procedure in php
User registration and login using stored procedure in php
 
Jsp Notes
Jsp NotesJsp Notes
Jsp Notes
 
TurboGears2 Pluggable Applications
TurboGears2 Pluggable ApplicationsTurboGears2 Pluggable Applications
TurboGears2 Pluggable Applications
 
Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0
Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0
Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0
 
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
 
Rest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.jsRest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.js
 
And now you have two problems. Ruby regular expressions for fun and profit by...
And now you have two problems. Ruby regular expressions for fun and profit by...And now you have two problems. Ruby regular expressions for fun and profit by...
And now you have two problems. Ruby regular expressions for fun and profit by...
 
Drupal 8 Deep Dive: What It Means for Developers Now that REST Is in Core
Drupal 8 Deep Dive: What It Means for Developers Now that REST Is in Core Drupal 8 Deep Dive: What It Means for Developers Now that REST Is in Core
Drupal 8 Deep Dive: What It Means for Developers Now that REST Is in Core
 

Viewers also liked

Designing of databases
Designing of databasesDesigning of databases
Designing of databasesAnsh Jhanji
 
Code snippets of PHP and Javascript by Anil Kumar Panigrahi
Code snippets of PHP and Javascript by Anil Kumar PanigrahiCode snippets of PHP and Javascript by Anil Kumar Panigrahi
Code snippets of PHP and Javascript by Anil Kumar PanigrahiAnil Kumar Panigrahi
 
Yii, frameworks and where PHP is heading to
Yii, frameworks and where PHP is heading toYii, frameworks and where PHP is heading to
Yii, frameworks and where PHP is heading toAlexander Makarov
 
Yii2 by Peter Jack Kambey
Yii2 by Peter Jack KambeyYii2 by Peter Jack Kambey
Yii2 by Peter Jack Kambeyk4ndar
 
IT People PechaKucha - Ульяна Ходоровская - Востребованность языков программи...
IT People PechaKucha - Ульяна Ходоровская - Востребованность языков программи...IT People PechaKucha - Ульяна Ходоровская - Востребованность языков программи...
IT People PechaKucha - Ульяна Ходоровская - Востребованность языков программи...PechaKucha Ukraine
 
Cannes 2008 Presentation
Cannes 2008 PresentationCannes 2008 Presentation
Cannes 2008 Presentationary stuifbergen
 
Шлях від студента до веб-розробника
Шлях від студента до веб-розробникаШлях від студента до веб-розробника
Шлях від студента до веб-розробникаArtem Henvald
 
PHP up file
PHP  up filePHP  up file
PHP up filetumetr1
 
PHP Frameworks and CodeIgniter
PHP Frameworks and CodeIgniterPHP Frameworks and CodeIgniter
PHP Frameworks and CodeIgniterKHALID C
 
Yii2 restful 基礎教學
Yii2 restful 基礎教學Yii2 restful 基礎教學
Yii2 restful 基礎教學Duncan Chen
 
Cтеки іт технологій
Cтеки іт технологійCтеки іт технологій
Cтеки іт технологійYevgen Vershynin
 
How the Web Works
How the Web WorksHow the Web Works
How the Web Workszachwise
 
About Best friends - HTML, CSS and JS
About Best friends - HTML, CSS and JSAbout Best friends - HTML, CSS and JS
About Best friends - HTML, CSS and JSNaga Harish M
 

Viewers also liked (20)

Designing of databases
Designing of databasesDesigning of databases
Designing of databases
 
Code snippets of PHP and Javascript by Anil Kumar Panigrahi
Code snippets of PHP and Javascript by Anil Kumar PanigrahiCode snippets of PHP and Javascript by Anil Kumar Panigrahi
Code snippets of PHP and Javascript by Anil Kumar Panigrahi
 
Yii, frameworks and where PHP is heading to
Yii, frameworks and where PHP is heading toYii, frameworks and where PHP is heading to
Yii, frameworks and where PHP is heading to
 
Yii2 by Peter Jack Kambey
Yii2 by Peter Jack KambeyYii2 by Peter Jack Kambey
Yii2 by Peter Jack Kambey
 
Web 2 0
Web 2 0Web 2 0
Web 2 0
 
Казнадзей назар. SendFlowers.ua. 2014
Казнадзей назар. SendFlowers.ua. 2014Казнадзей назар. SendFlowers.ua. 2014
Казнадзей назар. SendFlowers.ua. 2014
 
IT People PechaKucha - Ульяна Ходоровская - Востребованность языков программи...
IT People PechaKucha - Ульяна Ходоровская - Востребованность языков программи...IT People PechaKucha - Ульяна Ходоровская - Востребованность языков программи...
IT People PechaKucha - Ульяна Ходоровская - Востребованность языков программи...
 
зно 2012
зно 2012зно 2012
зно 2012
 
створення Web сторінок
створення Web сторінокстворення Web сторінок
створення Web сторінок
 
Cannes 2008 Presentation
Cannes 2008 PresentationCannes 2008 Presentation
Cannes 2008 Presentation
 
Internet
InternetInternet
Internet
 
Шлях від студента до веб-розробника
Шлях від студента до веб-розробникаШлях від студента до веб-розробника
Шлях від студента до веб-розробника
 
PHP up file
PHP  up filePHP  up file
PHP up file
 
Сервисы web 2.0
Сервисы web 2.0Сервисы web 2.0
Сервисы web 2.0
 
PHP Frameworks and CodeIgniter
PHP Frameworks and CodeIgniterPHP Frameworks and CodeIgniter
PHP Frameworks and CodeIgniter
 
Yii2 restful 基礎教學
Yii2 restful 基礎教學Yii2 restful 基礎教學
Yii2 restful 基礎教學
 
Cтеки іт технологій
Cтеки іт технологійCтеки іт технологій
Cтеки іт технологій
 
How the Web Works
How the Web WorksHow the Web Works
How the Web Works
 
About Best friends - HTML, CSS and JS
About Best friends - HTML, CSS and JSAbout Best friends - HTML, CSS and JS
About Best friends - HTML, CSS and JS
 
Html1
Html1Html1
Html1
 

Similar to Php frameworks

Create a web-app with Cgi Appplication
Create a web-app with Cgi AppplicationCreate a web-app with Cgi Appplication
Create a web-app with Cgi Appplicationolegmmiller
 
Exploring Symfony's Code
Exploring Symfony's CodeExploring Symfony's Code
Exploring Symfony's CodeWildan Maulana
 
Intro To Mvc Development In Php
Intro To Mvc Development In PhpIntro To Mvc Development In Php
Intro To Mvc Development In Phpfunkatron
 
P H P Part I I, By Kian
P H P  Part  I I,  By  KianP H P  Part  I I,  By  Kian
P H P Part I I, By Kianphelios
 
Testing persistence in PHP with DbUnit
Testing persistence in PHP with DbUnitTesting persistence in PHP with DbUnit
Testing persistence in PHP with DbUnitPeter Wilcsinszky
 
Practical catalyst
Practical catalystPractical catalyst
Practical catalystdwm042
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkBo-Yi Wu
 
Using Geeklog as a Web Application Framework
Using Geeklog as a Web Application FrameworkUsing Geeklog as a Web Application Framework
Using Geeklog as a Web Application FrameworkDirk Haun
 
Slick Data Sharding: Slides from DrupalCon London
Slick Data Sharding: Slides from DrupalCon LondonSlick Data Sharding: Slides from DrupalCon London
Slick Data Sharding: Slides from DrupalCon LondonPhase2
 
PHP and MySQL PHP Written as a set of CGI binaries in C in ...
PHP and MySQL PHP Written as a set of CGI binaries in C in ...PHP and MySQL PHP Written as a set of CGI binaries in C in ...
PHP and MySQL PHP Written as a set of CGI binaries in C in ...webhostingguy
 
How to Create Login and Registration API in PHP.pdf
How to Create Login and Registration API in PHP.pdfHow to Create Login and Registration API in PHP.pdf
How to Create Login and Registration API in PHP.pdfAppweb Coders
 
5 Reasons To Love CodeIgniter
5 Reasons To Love CodeIgniter5 Reasons To Love CodeIgniter
5 Reasons To Love CodeIgniternicdev
 
Php Data Objects
Php Data ObjectsPhp Data Objects
Php Data Objectshiren.joshi
 
Optimize Site Deployments with Drush (DrupalCamp WNY 2011)
Optimize Site Deployments with Drush (DrupalCamp WNY 2011)Optimize Site Deployments with Drush (DrupalCamp WNY 2011)
Optimize Site Deployments with Drush (DrupalCamp WNY 2011)Jon Peck
 
AEM Sightly Deep Dive
AEM Sightly Deep DiveAEM Sightly Deep Dive
AEM Sightly Deep DiveGabriel Walt
 

Similar to Php frameworks (20)

Create a web-app with Cgi Appplication
Create a web-app with Cgi AppplicationCreate a web-app with Cgi Appplication
Create a web-app with Cgi Appplication
 
Exploring Symfony's Code
Exploring Symfony's CodeExploring Symfony's Code
Exploring Symfony's Code
 
Intro To Mvc Development In Php
Intro To Mvc Development In PhpIntro To Mvc Development In Php
Intro To Mvc Development In Php
 
I Love codeigniter, You?
I Love codeigniter, You?I Love codeigniter, You?
I Love codeigniter, You?
 
Framework
FrameworkFramework
Framework
 
P H P Part I I, By Kian
P H P  Part  I I,  By  KianP H P  Part  I I,  By  Kian
P H P Part I I, By Kian
 
Testing persistence in PHP with DbUnit
Testing persistence in PHP with DbUnitTesting persistence in PHP with DbUnit
Testing persistence in PHP with DbUnit
 
Practical catalyst
Practical catalystPractical catalyst
Practical catalyst
 
What's New in ZF 1.10
What's New in ZF 1.10What's New in ZF 1.10
What's New in ZF 1.10
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC Framework
 
Using Geeklog as a Web Application Framework
Using Geeklog as a Web Application FrameworkUsing Geeklog as a Web Application Framework
Using Geeklog as a Web Application Framework
 
Slick Data Sharding: Slides from DrupalCon London
Slick Data Sharding: Slides from DrupalCon LondonSlick Data Sharding: Slides from DrupalCon London
Slick Data Sharding: Slides from DrupalCon London
 
PHP and MySQL PHP Written as a set of CGI binaries in C in ...
PHP and MySQL PHP Written as a set of CGI binaries in C in ...PHP and MySQL PHP Written as a set of CGI binaries in C in ...
PHP and MySQL PHP Written as a set of CGI binaries in C in ...
 
How to Create Login and Registration API in PHP.pdf
How to Create Login and Registration API in PHP.pdfHow to Create Login and Registration API in PHP.pdf
How to Create Login and Registration API in PHP.pdf
 
5 Reasons To Love CodeIgniter
5 Reasons To Love CodeIgniter5 Reasons To Love CodeIgniter
5 Reasons To Love CodeIgniter
 
working with PHP & DB's
working with PHP & DB'sworking with PHP & DB's
working with PHP & DB's
 
Php Data Objects
Php Data ObjectsPhp Data Objects
Php Data Objects
 
Nodejs.meetup
Nodejs.meetupNodejs.meetup
Nodejs.meetup
 
Optimize Site Deployments with Drush (DrupalCamp WNY 2011)
Optimize Site Deployments with Drush (DrupalCamp WNY 2011)Optimize Site Deployments with Drush (DrupalCamp WNY 2011)
Optimize Site Deployments with Drush (DrupalCamp WNY 2011)
 
AEM Sightly Deep Dive
AEM Sightly Deep DiveAEM Sightly Deep Dive
AEM Sightly Deep Dive
 

Recently uploaded

KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 

Recently uploaded (20)

KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 

Php frameworks

  • 2.
  • 3. What is a framework ? For example, in order for a program to get data from a mysql database, it has to undergo a list of actions: 1. Connect to the database server 2. Select a database 3. Query the database 4. Fetch the data 5. Use the Data A framework may handle steps 1-4 for you, so that your responsibilities are reduced to: 1. Tell the framework to fetch the data 2. Use the data
  • 4. Sample program in single tire architecture Connect to database : $db_host = “localhost&quot;; $db_name = “test&quot;; $db_username = “root&quot;; $db_password = “root&quot;; $conn = mysql_connect($db_host,$db_username,$db_password) or die(&quot;Could not connect to Server&quot; .mysql_error()); mysql_select_db($db_name) or die(&quot;Could not connect to Database&quot; .mysql_error()); <html> <head> </head> <body> Edit : <form:> get code from databse and display at values of input boxes </form> Display : <table> <?php $query=&quot;iselect * from users &quot;; $result = Mysql_query($query); While($get = mysql_fetch_assoc($result)) { ?> <tr><td><?php echo $get[‘name’]?></td></tr> <?php } ?> </table>
  • 5. Same program using two tire architecture At the PHP file : <?php require 'libs/Smarty.class.php'; include &quot;includes/functions.php&quot;; $smarty = new Smarty; $smarty->assign(&quot;title&quot;,“Get data from Database&quot;); $smarty->assign(&quot;keywords&quot;,get data, database&quot;); $smarty->assign(&quot;description&quot;,“Get data from database process &quot;) $query= “select * from users “; $result = Mysql_query(“$query”);” $getdata= mysql_fetch_array($result); $smarty->assign(&quot;data&quot;,$data); $smarty->display(‘userss.tpl'); ?> <!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;> <html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;> <head> <meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=utf-8&quot; /> <title>{$title}</title> <meta name=&quot;keywords&quot; content=&quot;{$keywords}&quot; /> <meta name=&quot;description&quot; content=&quot;{$description}&quot; /> <<h1 class=&quot;title“>Smarty !</h1> <ul class=&quot;list&quot; > {section name=rows loop=$data} {$data[rows]} {/section} </dody> </html> At a .tpl file
  • 6.
  • 7.
  • 8.
  • 9. MVC
  • 10.
  • 11. Comparison of frameworks
  • 12.
  • 13.
  • 14. Configure the file: system/application/config/ $config['base_url'] = 'http://localhost/'; $config['index_page'] = ''; Default Settings : $config['charset'] = “UTF-8”; $config['cache_path'] = ''; $config['permitted_uri_chars'] = 'a-z 0-9~%.:_-'; $config['log_date_format'] = 'Y-m-d H:i:s'; $config['global_xss_filtering'] = TRUE; To configure the databse: applicationonfigatabase.php $db['default']['hostname'] = “”; // Host Name $db['default']['username'] = “”; // User Name $db['default']['password'] = “”; // Password $db['default']['database'] = “”; // Database Name $db['default']['dbdriver'] = “”; // Databse driver.
  • 15. CodeIgniter URLs example.com/index.php/news/article/my_article news – Controller article – class function my_article - any additional segments If we add the below contents at .htaccess file DirectoryIndex index.php RewriteEngine on RewriteCond $1 !^(indexphp|images|css|js|robotstxt|faviconico) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ ./index.php/$1 [L,QSA] Then URLs will change it into. example.com/news/article/my_article
  • 16. <?php class Upload extends Controller { function Upload() { parent::Controller(); /* $this->load->helper('form');*/ } function index() { if ($this->session->userdata('logged_in') != TRUE) { redirect(base_url().'user/login'); } else { //echo $this->session->userdata('name'); $data['login']=$this->session->userdata('name') ; } $this->load->database(); $data['title']=&quot;Welcome to CodeIgniter Upload Images&quot;; $this->load->view('header',$data); $this->load->view('upload_form'); $this->load->view('footer'); } function _createThumbnail($fileName) { $config['image_library'] = 'gd2'; $config['source_image'] = 'uploads/' . $fileName; $config['create_thumb'] = TRUE; $config['maintain_ratio'] = TRUE; $config['width'] = 75; $config['height'] = 75; $this->load->library('image_lib', $config); if(!$this->image_lib->resize()) echo $this->image_lib->display_errors(); } Controller
  • 17. function list_images() { $this->load->database(); $this->load->library('pagination'); $config['total_rows'] = $this->db->count_all('code_image'); $config['per_page'] = '3'; $config['full_tag_open'] = '<p>'; $config['full_tag_close'] = '</p>'; $config['base_url'] = base_url().'upload/list_images/'; $this->pagination->initialize($config); //echo base_url(); $this->load->model('code_image'); $data['images'] = $this->code_image->get_images($config['per_page'],$this->uri->segment(3)); // This gives us anchor() - see the view at the end $data1['login']=$this->session->userdata('name') ; $data1['title']=&quot;List of images in the Website&quot;; $this->load->view('header',$data1); $this->load->helper('url'); $this->load->view('list_images', $data); $this->load->view('footer'); } function view_image($image_id) { $this->load->database(); $this->load->model('code_image'); $data['image'] = $this->code_image->get_image($image_id); $data1['login']=$this->session->userdata('name') ; $data1['title']=&quot;List of images in the Website&quot;; $this->load->view('header',$data1); $this->load->view('view_image', $data); $this->load->view('footer'); } }
  • 18. <?php class Code_image extends Model { function get_images($num, $offset) { $query = $this->db->get('code_image', $num, $offset); //$query = $this->db->get('code_image'); foreach ($query->result_array() as $row) { $result[] = $row; } return $result; } function get_image($image_id) { $query = $this->db->where('image_id', $image_id)->get('code_image'); $result = $query->row_array(); return $result; } } ?> Model
  • 19. <table width=&quot;900&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; class=&quot;content&quot; > <tr><td><p>List Out Photos </p></td></tr> <tr> <td width=&quot;400&quot;> <table align=&quot;center&quot;> <?php foreach ($images as $image): ?> <tr><td colspan=&quot;2&quot; style=&quot; border-top:1px solid #669966;&quot;>&nbsp;</td></tr> <tr > <td width=&quot;200&quot;><img alt=&quot;Your Image&quot; src=&quot;<?= base_url() . 'uploads/' . $image['image_thumb'];?>&quot; /></td> <td width=&quot;200&quot;><?=anchor( base_url().'upload/view_image/'.$image['image_id'], 'View')?></td> </tr> <tr><td colspan=&quot;2&quot; style=&quot; border-bottom:1px solid #669966;&quot;>&nbsp;</td></tr> <?php endforeach; ?> <tr><td colspan=&quot;2&quot; style=&quot; border-bottom:1px solid #669966;&quot; align=&quot;right&quot;> <?php echo $this->pagination->create_links(); ?> &nbsp;</td></tr> </table> </td> </tr> </table> Particular Image <table width=&quot;900&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; class=&quot;content&quot; > <tr><td><p>View Image </p></td></tr> <tr> <td width=&quot;400&quot;> <table align=&quot;center&quot;> <tr><td colspan=&quot;2&quot; style=&quot; border-top:1px solid #669966;&quot;>&nbsp;</td></tr> <tr > <td width=&quot;400&quot;><img alt=&quot;Your Image&quot; src=&quot;<?= base_url() . 'uploads/' . $image['image_name'];?>&quot; /></td> </tr> <tr><td colspan=&quot;2&quot; style=&quot; border-bottom:1px solid #669966;&quot;>&nbsp;</td></tr> </table> </td> </tr> </table> Views
  • 20. <table width=&quot;900&quot; height=&quot;200&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; class=&quot;content&quot; > <tr><td colspan=&quot;3&quot; align=&quot;left&quot;><h2>Upload an Image </h2></td></tr> <?php echo form_open_multipart(base_url().'upload/doUpload'); ?> <tr valign=&quot;top&quot;><td colspan=&quot;3&quot; align=&quot;center&quot;> <table cellpadding=&quot;0&quot; cellspacing=&quot;2&quot; border=&quot;0&quot;> <tr> <td>&nbsp;</td> <td>Image Name: </td> <td><input type=&quot;file&quot; name=&quot;userfile&quot; /></td> <td>&nbsp;</td> <td><input type=&quot;image&quot; src=&quot;<?=base_url()?>images/upload.png&quot; value=&quot;Login&quot; /></td> </tr> </table> </td> </tr> <?php echo form_close(); ?> </table> Upload a image
  • 21. List of images : URL : http://localhost/codeigniter/upload/list_images
  • 22. Particular Image URL : http://localhost/codeigniter/upload/view_image/1
  • 25.
  • 26. For any quires - kumaranil21@gmail.com Thank you