tech talk: php

17
Tech Talk: PHP Lee Jen Wei

Upload: jen-wei-lee

Post on 08-Aug-2015

78 views

Category:

Technology


0 download

TRANSCRIPT

Tech Talk: PHP

Lee Jen Wei

Overview

Web Development Trends What is PHP ? MVC Frameworks Mobile Web Apps Command Line PHP Sites Using PHP Pros Cons References

Web Development Trends

PHP Ruby (on Rails) Python (Django) ASP.NET JavaScript (Ajax, Node.js, AngularJS, Backbone.js,

Ember.js etc) Java Perl Scala (Play Framework) Erlang Clojure Groovy/Grails etc

What is PHP?

PHP is mainly focused on server-side scripting, so you can do anything any other CGI program can do, such as collect form data, generate dynamic page content, or send and receive cookies.

The best things in using PHP are that it is extremely simple for a newcomer, but offers many advanced features for a professional programmer.

PHP: Hypertext Preprocessor

Development started in 1994, by Rasmus Lerdorf. Server-side scripting language Interpreted language Multi-platform (Linux, *nix, Windows) Syntax resembles C and Perl Simpler and faster to develop in (than C and Perl

or Java) Fast, flexible and pragmatic

What is PHP?Example:

Where does PHP fit ?

Web Browser

Internet orIntranet

page

Web

HTTPRequest

Page

Webpage

Web

Server

server

Addedfunction

ality

Addedfunction

ality

Client-side“Active pages”

JavaScript, VBScript,

Applet, ActiveX

Server-side“Dynamic

pages”

CGI, SSI, Server API,

ASP, JSP, PHP, COM/DCOM,

CORBA

Active and dynamic page technology can be used together – server-side program generates customized active pages.

Putting it all together

Web-ClientWeb-Server

DBMS

DatabaseOutput

SQL commands

PHP

HTML-Form (+JavaScript)

Reply

WWW

SubmitData

Call PHPinterpreter

Response Response

LAN

Web-Browser

DatabaseServer

PHP – MVC Frameworks

Model-View-Controller (MVC)YiiCakePHPCodeIgniterSymfonyZend FrameworkKohanamany others

PHP – Mobile Web Apps

Common to use server-side PHP to develop Mobile Web Apps or Hybrid Apps Reuse php web site backend components and logic Enjoy the advantages of PHP

Eg. PHP Yii Framework + jQuery Mobile (or any mobile web app framework)

Command Line PHP

What is this good for: Parsing files to put into a database Ideal for scripts regularly executed using cron (on

*nix or Linux) or Task Scheduler (on Windows). Anything you use a shell script or perl script to do

Variables of use: $argc, $argv[] $stdin, $stdout, $stderr

Sites using PHP

Sites using PHP

Yahoo, Facebook, Google, YouTube, eBay, Flickr, Zynga, Wikipedia, Craiglist, Digg

Cisco, Oracle, Intel, Nokia, China Mobile, Wordpress sites (CMS), Drupal sites (CMS) etc

PHP - Pros

Open source, completely free Specifically designed for Web Development /

Developers Excellent documentation Simplicity, Easy to learn, including frameworks Largest community support Multi-platforms Easy deployment (just copy the files) Easy to scale up and out Readily available pool of talents/coders

PHP - Pros

Rapid prototyping, fast development time Lightweight, low overheads Fast execution time Silo process, loosely coupled Highly configurable Procedural / Object Oriented programming Extensive libraries / modules Support wide range of interfaces (DB, Outputs,

Protocols, Caching etc)

PHP - Cons

Best used with caching stack Not thread-safe Less efficient multithreading support No strong standards of coding style Flexible, many ways to accomplished same task Not strongly typed, implicit conversion Not particularly sexy No built-in scheduler Not good for GUI or desktop apps

References

www.php.net pecl.php.net pear.php.net www.yiiframework.com cakephp.org www.codeigniter.com