1 / 26

Introduction to PHP application development

A comprehensive roadmap for PHP application development, including steps to transition to a Services Oriented Environment, refreshing applications, and integrating new technologies with traditional code.

hazela
Télécharger la présentation

Introduction to PHP application development

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to PHP application development

  2. SystemiDeveloper Roadmap

  3. Goals of the Roadmap • Present development technologies for all aspects of development • Provide steps to get to a Services Oriented Environment • Refreshing applications • GUI, Modular Code, Better Structure • Development of new business functions • Inclusion of prepared components • Allow merging of new technology with traditional code • Integration of applications and business processes • Allow gradual growth of skills • Living document • based on experience and technology

  4. Model Assemble Deploy Monitor Consumer Provider Industry Direction for Development - SOA Create • Services Available • Application Created • On-going monitoring • Business Processes/ Services • RPG Modules • HTML Forms • Java beans RPG COBOL C/C++ 4GL PHP Tools • Order Entry • Billing • Inventory • Accounting • Payroll • Sales Analysis • ERP • CRM • etc • Link information • URL • Web Services Description Language • ILE Location • Customer Check • Credit Check • Inventory lookup • Notify customer • Develop • Modularize Existing • Locate from other

  5. Model Assemble Deploy Monitor Create XML Web COBOL System i Developers’ Road Atlas Logic Database Presentation UI Traditional Applications i5/OS New Components Java DB2 for i5/OS Other Sources Visual Development Tools Code Generators Web Downloads Visual Editors SQL 4GL

  6. “SOA in a Box”?? Order Processing Customer Service Warehouse Commerce Linux Visual Basic Order Acknowledgement System (acknowledge order) C++ Order Fulfillment System (Fulfill order) RPG Order Entry System (Take order via Web) PHP Web Commerce System Firewall Apache HTTP Server MQ Fulfill WBI Acknowledge Web Services Order Forward e-mail customer MQ Confirm HQ Accounting MQ GL entries POWER Hypervisor

  7. Model Assemble Deploy Monitor Create Where are You Now? Traditional Applications New Components DB2 for i5/OS Other Sources

  8. XML COBOL Languages Available for i5/OS • Programming Languages Available at V5R4 of i5/OS • RPG IV • ILE COBOL • ANSI ’85 with extensions • ILE C • ANSI ’99 with extensions • ILE C++ • ANSI ’98 with extensions • Java • JDK 1.3, 1.4 and 1.5 • 32-bit JVM only 1.5 • SQL • ANSI 2003 • XML • Version 1.1 • PHP • Version 5.1.4 Java SQL

  9. WDSc: Integrated Development Environment Java • Perspectives: • RSE • RPG, COBOL, CL, DDS • Java • Web • including web services • XML • Database • EJB Remote System Explorer XML Web

  10. PHP and the System i • Scripting language for developing Web applications. • Scripts are embedded within HTML documents. • Scripts are processed when needed (not compiled). • Simple • Easy to learn and use • Powerful • Supports most protocols, data sources, data manipulation • Independent • Supported by almost every HTTP server, operating system, DB • Free • Open-source with large community providing extensions, documentation, templates, sample code

  11. PHP Value Proposition • Gain the benefits of a Web interface • Without the need for an application server • Web browser is the only system requirement • (same for Net.Data and CGI) • Run ISV and other PHP applications on i5/OS • This is the platform they have and know • Large community of users • Higher quality in products, tools, code samples and documentation • Easier to recruit new skilled programmers • Affordable support • Users helping users, less expensive consulting services • Large library of open-source sample applications

  12. Summary – System i Developer Roadmap • Many development technologies available for System i • Many possible paths to a Services Oriented Environment • Refreshing applications • GUI, Modular Code, Better Structure • Development of new business functions • Inclusion of prepared components • Accommodate the merging of new technology with traditional code • Integration of applications and business processes

  13. Model Assemble Deploy Monitor Create XML Web COBOL System i Developers’ Road Atlas Logic Database Presentation UI Traditional Applications i5/OS New Components Java DB2 for i5/OS Other Sources Visual Development Tools Code Generators Web Downloads Visual Editors SQL 4GL

  14. Introduction to the PHP language

  15. Basic syntax • Flat-text files with a PHP extension (or whatever Zend Core is configured to process) • Can by used for command scripting (using the i5/OS PASE utilities) • Typically used to add dynamic function to HTML • PHP code embedded in PHP tags: <?php // PHP code ?> • Lines are delimited with a semicolon (;) • PHP code is processed and the results are sent to the user as HTML

  16. Variables • Variables • Are signified by a dollar sign ($): $myvar • Start with a letter or underscore(_), contain only alphanumeric characters and underscore, and are CaSe-SeNsiTiVe • Unlike C/C++/Java, variable type is not declared. • Determined at runtime by the interpreter as one of the following data types: • Boolean • Integer • Float • String • Array • Object • Resource • Null

  17. Arrays • An array in PHP is actually an ordered map • Keys are mapped to values • Can be used as a list, vector, hashtable, dictionary, collection, stack, queue, etc. • Can be of three types: • Numeric • $customer[0] = ‘Foo Widgets’; • Associative • $customer[‘name’] = ‘Foo Widgets’; • Multidimensional • $data[‘customer’][‘name’] = ‘Foo Widgets’;

  18. if / elseif / else if ($x > 0) { // do this } elseif ($x < 0) { // do this } else { // do this } foreach foreach($customer as $value) { echo “Customer: $customer”; } while while ($y < 0) { y++; } do-while do { y++; } while ($y < 0); for for ($i = 0; $i < 10; $i++) { echo “Number: $i”; } Control statements

  19. Resources for the PHP language • php.net documentation: • http://www.php.net/manual/en/ • Zend Developer Zone: Tutorials • http://devzone.zend.com/public/view/tag/tutorials • W3 Schools: PHP • http://www.w3schools.com/php/default.asp

  20. Application development architecture

  21. Design • It is easy to write PHP without thinking about design • Bad separation of display and logic • No reuse • Poor maintainability • Inflexible to changes in technology • Take time to gather requirements and work out a design • Can use standard modeling tools for design work

  22. View View View View Model View Model Model Model Model Enterprise information systems Model-View-Controller (MVC) architecture • The controller directs traffic through the application • The model represents business logic and often accesses business resources • The view is the display HTTP request HTTP response Controller

  23. View register.php order.php query.php Sample MVC architecture HTTP request HTTP response Controller index.php Model Customer model Order model Database Data access helper Connection helper

  24. Separation of display and logic • Minimize code in the view • Code should only be used for displaying variable data – not performing processing (which should be done in the model) • Separate HTML from PHP wherever possible • HTML form in one file, PHP form handler in another file • Better opportunity for reuse and migration • Can reuse HTML if switching to another dynamic technology • Can reuse PHP if switching to another formatting language • Static pages require little to no processing • Probably results in smaller files that are easier to read and maintain

  25. Zend Framework • Provides a repository of components that you can use in your PHP applications • Provides a systematic MVC architecture and supporting application programming interfaces (APIs) • Currently a preview • Available at http://framework.zend.com/

  26. Lab exercise: Development

More Related