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 or
Intranet
page
Web
HTTP
Request
Page
Web
page
Web
Server
server
Added
function
ality
Added
function
ality
Client-side
“Active pages”
JavaScript, VBScript,
Applet, ActiveX
Server-side
“Dynamic pages”
CGI, SSI, Server
API, ASP, JSP, PHP,
COM/DCOM,
CORBAActive and dynamic page technology
can be used together – server-side
program generates customized active
pages.
Putting it all together
Web-Client
Web-Server
DBMS
Database
Output
SQL
commands
PHP
HTML-Form
(+JavaScript)
Reply
WWW
Submit
Data
Call PHP
interpreter
Response Response
LAN
Web-Browser
Database
Server
PHP – MVC Frameworks
Model-View-Controller (MVC)
Yii
CakePHP
CodeIgniter
Symfony
Zend Framework
Kohana
many 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

Tech talk: PHP

  • 1.
  • 2.
    Overview  Web DevelopmentTrends  What is PHP ?  MVC Frameworks  Mobile Web Apps  Command Line PHP  Sites Using PHP  Pros  Cons  References
  • 3.
    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
  • 4.
    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.
  • 5.
    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
  • 6.
  • 7.
    Where does PHPfit ? Web Browser Internet or Intranet page Web HTTP Request Page Web page Web Server server Added function ality Added function ality Client-side “Active pages” JavaScript, VBScript, Applet, ActiveX Server-side “Dynamic pages” CGI, SSI, Server API, ASP, JSP, PHP, COM/DCOM, CORBAActive and dynamic page technology can be used together – server-side program generates customized active pages.
  • 8.
    Putting it alltogether Web-Client Web-Server DBMS Database Output SQL commands PHP HTML-Form (+JavaScript) Reply WWW Submit Data Call PHP interpreter Response Response LAN Web-Browser Database Server
  • 9.
    PHP – MVCFrameworks Model-View-Controller (MVC) Yii CakePHP CodeIgniter Symfony Zend Framework Kohana many others
  • 10.
    PHP – MobileWeb 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)
  • 11.
    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
  • 12.
  • 13.
    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
  • 14.
    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
  • 15.
    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)
  • 16.
    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
  • 17.
    References  www.php.net  pecl.php.net pear.php.net  www.yiiframework.com  cakephp.org  www.codeigniter.com