PHP Frameworks. Topics What is the framework? What is the framework? Why framework? Why framework? MVC Framework. MVC Framework. Ben-fits and Drawbacks.

Slides:



Advertisements
Similar presentations
PHP + Framework + MVC. What is Framework? Common code - Generic functionality Extensible - Specific functionality Unlike library – Flow Dictated by.
Advertisements

Ian J Robotham Software Development Lead Medi-CAL Unit, University of Aberdeen.
INTRODUCTION TO ASP.NET MVC AND EXAMPLE WALKTHROUGH RAJAT ARYA EFECS - OIM DAWG – 4/21/2009 ASP.NET MVC.
1.  Understanding about How to Working with Server Side Scripting using PHP Framework (CodeIgniter) 2.
{ Model View Controller ASP.NET By Scott Crooks & Maggie Wettergreen.
Web Applications Development Using Coldbox Platform Eddie Johnston.
Fabian Vilers Hands on ASP.NET MVC.
Software Freedom Day th September 2007 Asia Pacific Institute of Information Technology Colombo, Sri Lanka. Nazly Ahmed Scripting The Web.
Fast Track to ColdFusion 9. Getting Started with ColdFusion Understanding Dynamic Web Pages ColdFusion Benchmark Introducing the ColdFusion Language Introducing.
Drupal Create a website/web app quickly with this Content Management System Jiaying Xu Spring 2011 COMS E6125 Web-enHanced Information.
Web Servers How do our requests for resources on the Internet get handled? Can they be located anywhere? Global?
Software Architecture Patterns (2). what is architecture? (recap) o an overall blueprint/model describing the structures and properties of a "system"
DR. MOHAMMAD IQBAL THANKS TO ADITYA SENGUPTA Comparing Web Frameworks.
Web Application Architecture: multi-tier (2-tier, 3-tier) & mvc
Overview of Framework by Ahamed Rifaudeen A. page - i Steps before entering into the Framework?  Basic knowledge of object-oriented programming (OOP)
UNIT-V The MVC architecture and Struts Framework.
22-Aug-15 | 1 |1 | Help! I need more servers! What do I do? Scaling a PHP application.
Danielle Baldwin, ITS Web Services CMS Administrator Application Overview and Joomla 1.5 RC 1 Highlights.
K.SWETHA. CSE-IV-A 08Q61A  INTRODUCTION  HISTORY  WORKING PROCESS  TECHNOLOGIES  ADVANTAGES AND DISADVANTAGES  CONCLUSION.
CodeIgniter - [Overview]
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
PHP AIGERIM. Topics What is the framework? What is the framework? Why framework? Why framework? MVC Framework. MVC Framework.
Sayed Ahmed Computer Engineering, BUET, Bangladesh MSC, Computer Science, U of Manitoba, Canada
JavaScript, Fourth Edition Chapter 12 Updating Web Pages with AJAX.
Sys Prog & Scripting - HW Univ1 Systems Programming & Scripting Lecture 19: Database Support.
Codeigniter is an open source web application. It occupies a very small amount of space in the memory and is most useful for developers who aim to develop.
COLD FUSION Deepak Sethi. What is it…. Cold fusion is a complete web application server mainly used for developing e-business applications. It allows.
Prestashop is an open source e-commerce application. It is written in PHP and is based on Smarty template engine. It can incorporate the advantages of.
Comp4711 – Internet Development CodeIgniter Cookbook Comp4711 #2 – Sept 14, 2011.
Pemrograman Web MVC Programming and Design Pattern in PHP 5.
Lecture 10 – MYSQL and PHP (Part 2)
Symfony web development framework is used to develop rapid, complex and large scale web applications faster and in an effective way.
Arnold Geraldo Designing and Making of The Online Auction Website Using CakePHP Framework.
Mr. Justin “JET” Turner CSCI 3000 – Fall 2015 CRN Section A – TR 9:30-10:45 CRN – Section B – TR 5:30-6:45.
Web Application Design Patterns. Large Scale Architectures Early systems were monolithic applications –Large and hard to maintain Then came the client-server.
MVC Concepts Basics Model-View-Controller (MVC) Concepts for Web Developers SoftUni Team Technical Trainers Software University
JakeShop A complete application for online commerce by Jake Feasel.
PHP Database connectivity Connecting with RDBMS and editing, adding, and deleting databases therein are all done through PHP functions.
Model View Controller. Tipe framework yang dominan: MVC Framework yang berdasarkan MVC membagi komponen dalam 3 bagian – Model, View, Controller Controller.
Apache JMeter By Lamiya Qasim. Apache JMeter Tool for load test functional behavior and measure performance. Questions: Does JMeter offers support for.
 Registry itself is easy and straightforward in implementation  The objects of registry are actually complicated to store and manage  Objects of Registry.
NMD202 Web Scripting Week5. What we will cover today PHP & MySQL Displaying Dynamic Pages Exercises Modifying Data PHP Exercises Assignment 1.
Nested componentization for advanced Web portal solutions Svebor Prstačić, dipl. ing., Dr. sc. Ivan Voras, Dr. sc. Mario Žagar.
MySQL. Is a SQL (Structured Query Language) database server. Can be accessed using PHP with embedded SQL Queries Supports Large DB’s, 60,000 tables with.
MVC WITH CODEIGNITER Presented By Bhanu Priya.
Date : 3/04/2010 Web Technology Solutions Class: PHP Web Application Frameworks.
Martin Kruliš by Martin Kruliš (v1.1)1.
CSC 2720 Building Web Applications Basic Frameworks for Building Dynamic Web Sites / Web Applications.
Mr. Justin “JET” Turner CSCI 3000 – Fall 2015 CRN Section A – TR 9:30-10:45 CRN – Section B – TR 5:30-6:45.
Working With Database Library And Helpers. Connecting to your Database First you need to set parameters in you database.php file residing in config folder.
ASP.NET MVC An Introduction. What is MVC The Model-View-Controller (MVC) is an architectural pattern separates an application into three main components:
APACHE STRUTS ASHISH SINGH TOMAR ast2124. OUTLINE Introduction The Model-View-Controller Design Pattern Struts’ implementation of the MVC Pattern Additional.
10 Most Popular PHP Frameworks for Modern Web Development
Top 50 Interview Questions & Answers in CakePHP. 2 Question : 1 What is CakePHP?  CakePHP is a free, open-source, rapid development framework for PHP.
EGI NA3 – Web site training services University of Edinburgh (0.25 funded FTE)
Introduction The concept of a web framework originates from the basic idea that every web application obtains its foundations from a similar set of guidelines.
By TOPS Technologies Easy to Used PHP Frameworks 1
 Joomla provides the free and open source content management system for publishing web content.  It is build on model-view- controller web application.
Web Technology Solutions
Working with Server Side Scripting: PHP Framework (CodeIgniter)
What is Laravel ? By Georgi Genov.
Yii.
Introduction To Codeigniter
Top 12 PHP Frameworks 2016.
Introduction to CodeIgniter (CI)
Content Management System
Lecture 1: Multi-tier Architecture Overview
PHP Frameworks.
…and web frameworks in general
Top 10 PHP Frameworks in PHP is one of the most sought after choices for programmers. Hypertext Pre-processor is chiefly used as a server-side open.
Presentation transcript:

PHP Frameworks

Topics What is the framework? What is the framework? Why framework? Why framework? MVC Framework. MVC Framework. Ben-fits and Drawbacks of MVC. Ben-fits and Drawbacks of MVC. PHP Frameworks PHP Frameworks Example application using one of framework Example application using one of framework Screenshots Screenshots References References

What is a framework ? 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"; $db_name = “test"; $db_username = “root"; $db_password = “root"; $conn = mysql_connect($db_host,$db_username,$db_password) or die("Could not connect to Server".mysql_error()); mysql_select_db($db_name) or die("Could not connect to Database".mysql_error()); Edit : get code from databse and display at values of input boxes Display : <?php $query="iselect * from users "; $result = Mysql_query($query); While($get = mysql_fetch_assoc($result)) { ?> <?php } ?>

Same program using two tire architecture At the PHP file : <?php require 'libs/Smarty.class.php'; include "includes/functions.php"; $smarty = new Smarty; $smarty->assign("title",“Get data from Database"); $smarty->assign("keywords",get data, database"); $smarty->assign("description",“Get data from database process ") $query= “select * from users “; $result = Mysql_query(“$query”);” $getdata= mysql_fetch_array($result); $smarty->assign("data",$data); $smarty->display(‘userss.tpl'); ?> {$title} Smarty ! {section name=rows loop=$data} {$data[rows]} {/section} At a.tpl file

Why framework? Developing an application from scratch is easy than maintaining it. So after the Developing an application from scratch is easy than maintaining it. So after the development the good thing is that its easy to maintain and add more features. development the good thing is that its easy to maintain and add more features. Its easy to handle the complex problems easily. Its easy to handle the complex problems easily. 1. Clean urls ( SEO friendly urls ) 1. Clean urls ( SEO friendly urls ) 2. We can standardization! 2. We can standardization! 3.Security 3.Security 4. Extensibility 4. Extensibility 5. Fast Loading 5. Fast Loading 6. Reusable of code 6. Reusable of code 7. increase flexibility 7. increase flexibility

MVC Framework -> MVC is a method of separating the user interface of an application from its Domain Logic. -> MVC stands for Model, View, and Controller. It aims to separate your app in these 3 components: Model: ● help you retrieve, insert, and update information in your database. View: ● the information that is being presented to a user. Controller: ● an intermediary between the Model, the View ● any other resources needed to process the HTTP request and generate a web page

- Substitutable user interface : - User interface components: - Multiple simultaneous views of the same model - Synchronized views - Easier user interface changes - Easier testing Benefits of using MVC Drawbacks of using MVC - Increased complexity - Close coupling of views and controllers to model - Potential for excessive updates - Close coupling between view and controller

MVC

Top 10 frameworks CodeIgniter Yii CakePHP Zend Symfony PHPDevShell Prado Akelos Zoop QPHP

Comparison of frameworks

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 component. 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. Modules: Indicates whether the framework has other modules, like an RSS feed parser, PDF module or anything else (useful). EDP: Event Driven Programming.New!

CodeIgniter Features

Configure the file: system/application/config/ $config['base_url'] = ' $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: application\config\database.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 !^(index\.php|images|css|js|robots\.txt|favicon\.ico) 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']="Welcome to CodeIgniter Upload Images"; $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'] = ' '; $config['full_tag_close'] = ' '; $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']="List of images in the Website"; $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']="List of images in the Website"; $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

List Out Photos " /> pagination->create_links(); ?> Particular Image View Image " /> Views

Upload an Image Image Name: images/upload.png" value="Login" /> Upload a image

List of images : URL :

Particular Image URL :

Upload an image

Upload success page

References PHP framework comparison benchmarks PHP framework comparison benchmarks Why Should we use a PHP Framework? Why Should we use a PHP Framework? CakePHP official site CakePHP official site CodeIgniter Site CodeIgniter Site PHP frameworks lists PHP frameworks lists

For any quires - Thank you