Developing Scalable Web Applications with PHP 5 and Symfony Jeff Jirsa Uniforum Chicago March 27, 2007.

Slides:



Advertisements
Similar presentations
Other Web Application Development Technologies. PHP.
Advertisements

By Brett Toothman Feed Me!. Overview Introduction Current Problem Project Description Deliverables Design Protocols Demonstration Conclusion.
CC SQL Utilities.
A Pragmatic Look At Symfony (The PHP5 framework) by Darren Beale Skillswap Bristol - 26 th July 2007.
1.  Understanding about How to Working with Server Side Scripting using PHP Framework (CodeIgniter) 2.
Intermediate Visual Basic CISP 371 CRC Prof. Chapman.
IWay Service Manager 6.1 Product Update Scott Hathaway iWay Software Copyright 2010, Information Builders. Slide 1.
MyIsern Lime MyIsern : A Web-based Collaboration Database By Kevin English University of Hawaii, ICS 613.
3rd Annual Plex/2E Worldwide Users Conference Page based on Title Slide from Slide Layout palette. Design is cacorp Title text for Title or Divider.
Lecture 4: Introduction to PHP 3 PHP & MySQL
DR. MOHAMMAD IQBAL THANKS TO ADITYA SENGUPTA Comparing Web Frameworks.
Migrating to EPiServer CMS 5 Johan Björnfot -
Phil Brewster  One of the first steps – identify the proper data types  Decide how data (in columns) should be stored and used.
UNIT-V The MVC architecture and Struts Framework.
RUBY ON RAILS It’s so rad. What we’ll cover  What is Ruby?  What is RoR?  Why RoR?  Developing with RoR  Deployment  Demo  Questions.
Introduction to the Enterprise Library. Sounds familiar? Writing a component to encapsulate data access Building a component that allows you to log errors.
S YMFONY ORM - D OCTRINE Sayed Ahmed B.Sc. Eng. in Computer Science & Engineering M. Sc. in Computer Science Exploring Computing for 14+ years
Training Course 2 User Module Training Course 3 Data Administration Module Session 1 Orientation Session 2 User Interface Session 3 Database Administration.
CSCI 6962: Server-side Design and Programming
Session 5: Working with MySQL iNET Academy Open Source Web Development.
Lecture 14 – Web Security SFDV3011 – Advanced Web Development 1.
PHP Programming with MySQL Slide 8-1 CHAPTER 8 Working with Databases and MySQL.
© 2003 By Default! A Free sample background from Slide 1 Week 2  Free PHP Hosting Setup  PHP Backend  Backend Security 
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.
Lecture 19 Web Application Frameworks Boriana Koleva Room: C54
Chapter 7 Working with Databases and MySQL PHP Programming with MySQL 2 nd Edition.
1 Dr Alexiei Dingli Web Science Stream Introducing Rails.
Module Info Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours
Tech Terminology for non-technical people Tim Bornholtz 2006 Annual Conference.
NMED 3850 A Advanced Online Design January 12, 2010 V. Mahadevan.
CAKEPHP Blog tutorial. what you’ll need examples/blog/blog.html 2  A running web server  A database server.
Looking for simple php script Language: PHP Must be php>>>>> I can not use an other language Budget: $30.0 If more than $30.0 Please do not bid Login page.
Proposal for the new group web infrastructure SFT Group meeting 3/7/2009 Yves Perrin.
Introduction to CS520/CS596_026 Lecture Two Gordon Tian Fall 2015.
What’s new in Kentico CMS 5.0 Michal Neuwirth Product Manager Kentico Software.
InfoBox A Personal Information Manager Built with Ruby on Rails Dustin Martin.
Ruby on Rails By S. Christopher Hellriegel. Overview 1. What is Ruby on Rails? 2. What is MVC? 3. Simple example 4. Wow, that was cool!
Date : 3/04/2010 Web Technology Solutions Class: PHP Web Application Frameworks.
CS 440 Database Management Systems Stored procedures & OR mapping 1.
Live. learn. work. play Superior Avenue Suite 310 Cleveland Ohio Tel: Fax:
Reactor An ORM framework for ColdFusion Presentation By: Doug Hughes
Drupal Basics May 30, 2012 By Sean Fitzpatrick. Sean Fitzpatrick | Welcome We're going to talk about Drupal We're going to keep it pretty.
Equipment and Help Call Management System (EHCMS) PresentedBy Kevin Hsu 3/13/2003.
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.
The Holmes Platform and Applications
Headstart Designer R Pasi Lehtinen TKP Tieto Oy
Web Technology Solutions
Magento Basics Getting started developing for Magento
Fundamental of Databases
Building Enterprise Applications Using Visual Studio®
What is Laravel ? By Georgi Genov.
MVC Architecture, Symfony Framework for PHP Web Apps
BASIC INFORMATION ABOUT DATABASE MANAGEMENT SOFTWARE
Content Management Systems
Haritha Dasari Josue Balandrano Coronel -
PHP Training at GoLogica in Bangalore
HR Portal Team Dr. Ashraf Armoush Supervisor Ala’eddeen Awwad
Task Management System (TMS)
PHP / MySQL Introduction
Template library tool and Kestrel training
…and web frameworks in general
Design and Maintenance of Web Applications in J2EE
Manage your Interest Group
Chapter 8 Working with Databases and MySQL
iCIMS 17.1 Release: Highlights
SiteBuilder 2 Introduction.
XML Based Learning Environment
…and web frameworks in general
Confluence (wiki) Short practical guide afris
SDMX IT Tools SDMX Registry
Presentation transcript:

Developing Scalable Web Applications with PHP 5 and Symfony Jeff Jirsa Uniforum Chicago March 27, 2007

My PHP Web Development Background ● Inherited a Perl/Mason customer sign-up application – Had a prior year's experience developing a Perl application – It sort of worked – Setup of Perl and Mason was a pain – Rewrote the application with PHP 4 – Created functions to encapsulate database access ● Started writing a CMS system a year and a half ago – Started with PHP 5 based object oriented framework – Database encapsulation and basic database classes – Didn't handle security and sessions – Presentation and business logic mixed together – Started using Symfony ( a year ago; version stable

What is Symfony? ● Its a web framework that was influenced by Ruby on Rails ● In 2003, Fabien Potencier from Sensio was looking for advanced PHP 5 tools to develop customer applications ● Symfony was first released in October 2005 based on Mojavi (MVC), Propel (ORM), and Ruby on Rails template helpers ● What makes it compelling? ● Well designed, based on tested components ● Full feature set ● Good documentation ● Easy to develop applications ● A version tool you can rely on! ● Community

Design ● YAML Configuration – YAML: Yet Another Markup Language – Used for all configuration settings, including the database schema – Example ● pager: size: 10 corporate: accounting: logging: – At run-time the configuration files are converted to PHP

Design ● The MVC Pattern – Pattern: a blueprint for design – MVC: Model, View, Controller ● Model: Database and Business logic ● View: Presentation using templates ● Controller: Routes the actions driven by the user

Design ● Database Abstraction and Object Relational Mapping (ORM) – The Database abstraction API (Creole) creates a uniform layer for accessing MySQL, Oracle, PostgreSQL, SQL Server, etc. ● Changing database settings are done through configuration ● Developing with one vendor database and switching to another for production is no problem – Object Relational Mapping (Propel) ● Removes (most of) the need for writing SQL statements ● Lets developer deal with record objects ● Related tables are accessed through get() methods ● A standardized file/directory structure separates all aspects of a project into their logical components ● The core framework that handles the YAML, MVC architecture, ORM, etc. are stored in the PEAR module

Feature Set ● Symfony is a combination of: – Frameworks, APIs: ● Mojavi (MVC framework), Creole (database abstraction), Propel (Object Relational Mapping), Javascript library (script.aculo.us/Prototype), Javascript calendar (Dynarch), PHPMailer ( class), Unicode (il8n), Prado (il8n classes) – And tools ● Spyc (YAML parser), Phing (project build utility based on Ant), pake (scafolding generator), and testing framework (lime)

Documentation ● On-line documentation sold me on the framework; 200+ pages – Plenty of examples – Developer encouraged to leave comments for corrections and tips ● “The Definitive Guide to symfony” came out recently just after was released – Replaced the original on-line documentation – Missing some of the information from the original documentation

Development Time for a demo!

Development ● Step 1: Create the project and the the front-end application – From a command line run: ● md cookbook ● Cd cookbook ● symfony init-project cookbook ● symfony init-app frontend

Development ● Step 2: Setup the database – Start the MySQL prompt and run: ● CREATE DATABASE cookbook; ● GRANT ALL PRIVILEGES ON cookbook.* TO IDENTIFIED BY 'cookbook';

Development ● Step 3: Alter the Propel configuration file – Edit config/propel.ini and add: ● propel.builder.tableType = InnoDB – If you will be using another vendor database with this project, add: ● propel.addVendorInfo = false

Development ● Step 4: Create the schema – Edit config/schema.yml and add: ● recipies: id: type: integer required: true autoIncrement: true primaryKey: true title: type: varchar size: 255 required: true instructions: type: longvarchar required: true

Development ● Step 5: Create the schema – Edit config/databases.yml and add: ● all: class: sfPropelDatabase param: username: cookbook password: cookbook dev: param: phptype: mysql hostspec: localhost database: cookbook

Development ● Step 6: Create the schema – Edit config/databases.yml (cont.) ● prod: param: phptype: mysql hostspec: localhost database: cookbook

Development ● Step 7: Generate the model – From a command line run: – symfony propel-build-model

Development ● Step 8: Generate the SQL schema – From a command line run: ● symfony propel-build-sql

Development ● Step 9: Load the SQL schema – From a MySQL prompt run: ● Source data\sql\lib.model.schema.sql

Development ● Step 10: Generate a module – We will need a simple link page for navigation – From a command line run: ● symfony module frontend menu ● edit apps\frontend\modules\menu\actions\actions.class.php – Comment out the forwarding call ● Edit apps\frontend\modules\menu\templates\indexSuccess.php – Add: ● The Symfony Cookbook

Development ● Step 11: Generate a CRUD module for Recipes – From a command line run: ● symfony propel-generate-crud frontend recipes Recipes

Development ● Step 12: Add the categories table – Edit config\databases.yml and add: ● category_id: type: INTEGER required: true foreignTable: categories foreignReference: id categories: id: type: integer required: true autoIncrement: true primaryKey: true name: type: varchar size: 50 required: true sort_order: type: integer required: true

Development ● Step 13: Regenerate the model and SQL schema – From the command line run: ● symfony propel-generate-model ● symfony propel-generate-sql

Development ● Step 14: Reload the SQL schema – From a MySQL prompt run: ● Source data\sql\lib.model.schema.sql

Development ● Step 15: Load the updated SQL schema – From the command line run: ● symfony propel-generate-crud frontend categories Categories ● symfony propel-generate-crud frontend recipes Recipes

Development ● Step 16: Add the validation error messages – From the command line run: ● md apps\frontend\modules\categories\validate ● Edit apps\frontend\modules\categories\validate\update.yml and add: – fields: name: required: msg: Please enter the name of the category. sfStringValidator: min: 5 min_error: "The category name must be at least 5 characters long." max: 50 max_error: "The category name can not be longer than 50 characters."

Development ● Step 17: Add the validation error handler – Edit apps\frontend\modules\categories\actions\actions.class.php and add: ● public function handleErrorUpdate() { if( $this->getRequestParameter('id') > 0 ) $this->forward('categories', 'edit'); else $this->forward('categories', 'create'); }

Development ● Step 18: Add the validation error display code – Edit apps\frontend\modules\categories\templates\editSuccess.php and add the following before the tagt: ● hasErrors()): ?> Please correct the errors: getErrors() as $name => $error): ?> :

Start Using Version 1.0.0! ● Its very easy to get started ● The documentation is very good – Needs to be more searchable on-line ● The core functionality is very solid ● Using a MVC and ORM based framework will make you productive – Symfony lets you focus on business rules, and design ● Comes with a complete toolbox

Start Using Version 1.0.0! ● The toolbox – YAML parser (Spyc) – Mojavi (MVC framework) – Creole (database abstraction) – Propel (object relational mapping) – Prado (il8n classes) – Javascript library (script.aculo.us/Prototype) – Javascript calendar (Dynarch) – Mail functions (or class? (PHPMailer) – pake (CLI utility) – testing framework (lime) – Phing (project build utility based on Ant)

Community and Resources ● The main web site – ● The forums – ● The wiki – ● IRC – #symfony on freenode.net ● The book – Available at Borders Book Stores

Community Questions?