Ph.P SOCIETY Philosophy in Programming Society
PHP in the Enterprise
Ph.P SOCIETY
Michael Cheng President / Founder, Founder, Philosophy in Programming Society
[email protected] (Zend Certified Engineer)
Ph.P SOCIETY
What is PHP? •
PHP is a scripting language designed for producing producing dynamic web pages.
•
It has evolved to include a command line interface capability and can be used in standalone graphical applications.
•
PHP is a widely-used general-purpose general-purpose scripting language that is especially suited for web development and can be embedded into HTML.
• •
It generally runs on a web server. Current Version: ersion: 5.2.8 - www.php.net Source: Wikipedia - http://en.wikipedia.org/wiki/Php
Ph.P SOCIETY
History • • • •
PHP started in 1995: Rasmus Lerdorf 1997: Zeev Suraski Sur aski and Andi Gutmans began a complete rewrite of PHP to make the language more powerful. PHP has come of age. Maturity in the language's syntax & features features - perfect balance of ease of use and performance.
Ph.P SOCIETY
Building Blocks of WWW
=
Ph.P SOCIETY
Easy to Learn & Code =
Its Free to Use! Ph.P SOCIETY
Its Ever Everywher ywhere! e!
=
Ph.P SOCIETY
Ph.P SOCIETY
The Thinking Man
=
Start Thinking... Ph.P SOCIETY
Iron Iron Thinking Thinking
Be Iron Man?
Or Sit Pretty? Ph.P SOCIETY
Let’s Start with a Smile.
Ph.P SOCIETY
One of the Greatest Minds
E=MC
2
Ph.P SOCIETY
Some of the Possibilities...
Ph.P SOCIETY
Time Time To Move Up... Up...
Let’s Build Skyscrapers
Ph.P SOCIETY
Benefits • • • •
Easy to pick-up. Syntax close to C. Motto: “Get Stuff Done Now”. Simplici Simplicity ty & Versatil ersatility ity.. Interpreted Interpreted not compiled.
• Just upload and its done! • • •
Support rapid & agile development. Ubiquity of web servers that supports PHP. Lower TCO T CO.. Ph.P SOCIETY
Syntax
Ph.P SOCIETY
SOAP Client try { $client = new SoapClient(’http://api.google.com/GoogleSearch.wsdl SoapClient(’http://api.google.com/GoogleSearch.wsdl’); ’); $results = $client->doGoogleSearch($key, $query, 0, 10, FALSE, ’’, FALSE, ’’, ’’, ’’); foreach ($results->resultElements as $result) { echo ’
URL) . ’">’; echo htmlentities($result->title, ENT_COMPAT, ’UTF-8’); echo ’’; } } catch (SoapFault $e) { echo $e->getMessage(); }
Ph.P SOCIETY
10 Point Plan: PHP in the Enterprise How to successful roll-out PHP in your company.
Ph.P SOCIETY
10-Point Plan The Tea eam m • The • Requirements • Architecture • Tools • Foundation
• Design Patterns • Testing • Optimization • Deployment • Operations Ph.P SOCIETY
1. The Team • •
Get a team together. Build up knowledge on PHP.
• • •
OOP in PHP. Extensions available.
Consider PHP Certification to fast-track your learning process.
Ph.P SOCIETY
2. Requirements •
Gather requirements.
• • • • • •
What does the customer want? What will visitors want? What does the customer really really need?
Functional design. Application flow diagrams Wire frames.
Ph.P SOCIETY
3. Archit Architec ectu ture re • •
Don’t be so eager to jump into coding. Data modeling.
• • • •
Class diagrams. Collaboration diagram. Use cases.
High Level Architectures
• •
Design Patterns SOA SOA Ph.P SOCIETY
4. Tools • •
The right tools help you get productive fast. Development Developm ent Tools: ools :
• • • •
Eclipse PDT / PHPClipse Komodo Zend Studio
Full IDE or Text Editor? Edit or?
• • •
Debugging / Profiling Syntax checking Cross Referencing / Navigation Ph.P SOCIETY
4. Tools •
Version Control
• • •
Subversion CVS
Documenta Documentation tion Tools Tools
• •
PHP Documentor (http://phpdoc.org) PHPXRef (http://phpxref.sourceforge.net (http://phpxref.sourceforge.net )
Ph.P SOCIETY
5. Foundation •
Good foundation will help in making your code more maintainable and scalable.
• •
SOP & Best Practices Use a framework
• • • •
Zend Framework (http://framework.zend.com) CakePHP (http://cakephp.org) Symfony (http://www.symfony-project.org (http://www.symfony-project.org)) Code Ignitor (http://codeigniter.com (http://codeigniter.com/) /)
Ph.P SOCIETY
6. Design Design Patterns Patterns • •
Best practice way of solving a particular problem. Patterns:
• • • • •
Model-View-Controller Factory Singleton Registry Decorator
Ph.P SOCIETY
7. Testing •
Various types of testing:
• • • • • •
Developer testing Functional testing Environment testing Performance testing Usability testing
Soluti Sol ution: on: Unit Unit Tes ests ts
• •
Automated testing after each change Prevents regressions Ph.P SOCIETY
7. Testing •
Testing for PHP P HP applications: appl ications:
• • •
PHPUnit http://www.phpunit.de/ http://www.phpunit.de/ SimpleTest http://www.lastcraft.com/simple_test.php
Continuous Integration:
• •
CruiseControl http://cruisecontrol.sourceforge.net / phpUnderControl http://www.phpundercontrol.org http://www.phpundercontrol.org//
Ph.P SOCIETY
8. Optimization •
Accelerators for PHP:
• • • •
APC http://pecl.php.net/package/APC eAccelerator http://eaccelerator.net/ http://eaccelerator.net/ Zend Platform http://www.zend.com/products/ zend_platform
PHP Caching solutions:
• • •
Zend_Cache http://framework.zend.com Zend Platform http://www.zend.com/products/ zend_platform Memcached http://danga.com/memcached/ http://danga.com/memcached/
Ph.P SOCIETY
9. Deployment •
Lifecycle:
• • • • • •
Develop Test Deploy to acceptance test environment Deploy to production server
Use Subversion or Capistrano Remember the database
Ph.P SOCIETY
9. Deployment •
Basic server installation.
Linux
Windows
Apache
IIS
Database
PHP Ph.P SOCIETY
Ph.P SOCIETY
10. Operations •
Monitoring Performance
• •
Debugging
• • •
Logs
A ‘root cause’ & analysis tool Context Capture
Change management:
• • •
Ticket system Stick to your deployment - use the DRP DON'T DON'T TOUCH THE LIVE ENVIR ENVI RONMENT ONMENT.. Ph.P SOCIETY
10-Point Plan The Tea Team m • The • Design Patterns • Requirements • Testing • Architecture • Optimization • Tools • Deployment • Foundation • Operations Ph.P SOCIETY
There’s More... •
Planning
• • • • • •
Development methodology (Waterfall / Agile) Software Development Life Cycle (SDLC)
Coding best practices Security Implementation Good luck!
Ph.P SOCIETY
About Michael • • • •
Web development business for 10+ years. Currently running a small web development & consulting business. Started Singapore PHP User Group in 2006 Regular monthly meetups since November 2007 (average turn out of 50 members); 480+ members to date.
Ph.P SOCIETY
History •
2nd Facebook Developer Garage at Microsoft Singapore Auditorium (5 March 2008).
Ph.P SOCIETY
History •
BarCamp II - Maps & Mobile Unconference (21 May 2008).
Wed, 21 May 2008 NUS Extension, Park Mall
Ph.P SOCIETY
The Philosophy in Programming Society • •
Registered as Ph.P Society in July 2008. Endorsed By:
Ph.P SOCIETY
Upcoming Events • • •
PHP Meetup (26 Feb - Oracle Singapore) Zend-PHP Certification Course (7 March) March) Enrichment Workshops (March 2009)
Ph.P SOCIETY
Workshops • • • • •
Intro to PHP CMSs
•
Visit http://www.php.org.sg for more details.
PHP Frameworks: Frameworks: A Primer Drupal, WordPress, Joomla Extensions Development Web 2.0 Mastery Foundation Course Building Rich Internet Apps: Javascript Frameworks Fra meworks
Ph.P SOCIETY
Michael Cheng
[email protected]
http://www.php.com.sg http://www.php.org.sg http://facebook.php.org.sg
Ph.P SOCIETY