This document discusses PHP development and deployment using Zend and Microsoft technologies. It provides an overview of the Zend stack including Zend Framework and Zend Studio for rapid development. It also covers deploying applications on Windows platforms using Zend Server and deploying to the cloud using Windows Azure. The document demonstrates sending emails and adding attachments using the Zend_Mail component of Zend Framework.
The Ultimate Guide to Choosing WordPress Pros and Cons
PHP and Zend Framework on Windows
1. PHP Development & Deploymentwith Zend and Microsoft Roy GanorZend Studio Project Leader, Zend Technologies Shahar EvronTechnical Product Manager, Zend Technologies
2. Welcome! Agenda Introductions An Overview of the Zend Stack Rapid Development with Zend Framework and Zend Studio Running on Windows Platforms with Zend Server A little bit of Cloud for dessert 2 PHP on Windows
8. Who are we? Roy Ganor Project Lead at Zend/Eclipse Contributing to the following projects: PHP Development Tools Ajax Tools Data Tools Dynamic Languages Tools Tools Matter! 4 PHP on Windows
9. PH What? Isn’t that like the hacker alternative to ASP.NET??!?
15. The Production Side… Clustering support Aggregated app monitoring Cross-server job queuing App monitoring & diagnostics Page caching, job queuing Support, updates and hot fixes Data caching and opcode acceleration Integrated, native installers Web admin console
16. And the Development Side Zend Server integration Zend Framework integration Team development Testing and debugging Support and updates Basic code editing Basic debugging Eclipse plug-in
17. Introducing the Eclipse Foundation 13 PHP on Windows A consortium of major software vendors, solution providers, corporations, educational and research institutions and individuals working together to create an eco-system that enhances, promotes and cultivates the Eclipse open platform with complementary products, services and capabilities
24. Introducing Zend Framework Some History: Started as part of the PHP Collaboration Project in late ‘05 First public release: 0.2, Early ‘06 1.0 Released on July 2007 Currently in version 1.10 (today!) Zend Framework 2.0 planning process started Open-source, business-friendly licensing Emphasis on high-quality, loose coupling and simplifying creation of modern Web Applications 18 PHP on Windows
30. Example: Zend_Mail Allows you to easily compose and send e-mail messages from your PHP applications Simplified control over recipients, headers, etc. Easy creation of multipart/alternative HTML messages Easy attachment handling Supports different delivery transports Allows you to read e-mail messages from POP3, IMAP, Mbox and Maildir not demonstrated here :) 21 PHP on Windows
31. Example: Zend_Mail – Sending a message 22 PHP on Windows // Load the Zend_Mail class require_once'Zend/Mail.php'; // Instantiate a new message object $message = new Zend_Mail('utf-8'); // Use the fluent interface to set message properties $message->setFrom('shahar.e@zend.com', 'Shahar E') ->setSubject('Hello, world!') ->setBodyText("Hi, what's up?") ->addHeader('Importance', 'high') ->addTo('someone@example.com', 'Some One') ->addCc('other.guy@example.com', 'Other Guy') ->addBcc('t.person@example.com', 'The Third Person'); // Send the message! $message->send();
32. Example: Zend_Mail – Adding Attachments 23 PHP on Windows // Load the Zend_Mail class require_once'Zend/Mail.php'; // Instantiate a new message object $message = new Zend_Mail('utf-8'); // Use the fluent interface to set message properties $message->setFrom(‘do-no-repoy@example.com', ‘Report System') ->setSubject('The report you have requested is ready') ->addTo('shahar@localhost', 'Shahar Evron'); // Add a PDF attachment (Will be base64 encoded) $pdf = $message->createAttachment(file_get_contents('report.pdf')); $pdf->type = 'application/pdf'; $pdf->filename = 'report.pdf'; // ... Continued on next slide ...
33. Example: Zend_Mail – Adding Attachments 24 PHP on Windows // Add a logo to the message - referenced from the message HTML body $img = $message->createAttachment(file_get_contents('logo.png')); $img->type = 'image/png'; $img->id = 'logo-image-png@example.com'; $img->filename = 'logo.png'; $img->disposition = Zend_Mime::DISPOSITION_INLINE; // Set the message body $message->setBodyHtml( "Hello Shahar,<br /><br />" . "The report you have requested is attached as a PDF file.<br /><br />" . "Enjoy!<br />" . '<imgsrc="cid:logo-image-png@example.com" alt="Example.com Logo" />' ); // Set the message MIME-type to multipart/related $message->setType(Zend_Mime::MULTIPART_RELATED); // Send the message! $message->send();
37. Starting a Zend Framework Project Starting a new project with Zend Studio, Zend Framework and Zend Server The Zend Framework MVC Outline Some Interesting Zend Framework Concepts & Components: Dispatching Zend Application Bootstrapping Zend_Config Controllers, Views & Layouts 28 PHP on Windows
38. Studio Features Studio Features to show during demo: PHPUnit Integration Zend Tool Refactoring AJAX Support Features 29 PHP on Windows
39. Deploying on the Windows Platform Some thoughts about Reliability and Scalability
40. Deploying and Running with Zend Server Deploying locally from Zend Studio to Zend Server Setting IIS to rewrite ZF requests Rely on Zend_Config to switch from dev config to production 31 PHP on Windows
41. Deploying In the Cloud – Windows Azure Eclipse Azure Plugin Simple Cloud API, Inter-cloud Interoperability Windows Azure Demo (???) 32 PHP on Windows
42. Windows Azure Table Storage A Highly Scalable Cloud Database Billions of records, terabytes of data “Entities” and “Properties” Not exactly a relational database ACID (Atomic, Consist, Isolated, Durable) Transactions Query syntax somewhat reminding SQL (but not really) Schema-less some structure can be enforced in client side Can be partitioned across servers 33 PHP on Windows
44. What have we learned? PHP Is Everywhere! PHP Is on Windows! No more excuses not to use it! :) PHP can become even more effective with the right tools Get an IDE and use it’s capabilities Get the framework that fits your needs, study it, and utilize it Standardize on a runtime environment Plan for the future, if you’re successful it will hit you fast! Plan for scaling Production Monitoring & Reliability, Moving to the Cloud 35 PHP on Windows
45. Thanks! Still have questions? roy@zend.com or @royganor shahar.e@zend.com or @shevron
46. Tips & Tricks Highlighted text can be displayed here Keep your slides clean: Avoid using more than 5 bullets Try to keep your bullets as short as possible Why? People usually don’t read slides with a lot of text Easier to memorize 37 PHP on Windows
Notas del editor
As a result of increased maturity of PHP and eco-system it has accelerated adoption within the Enterprise. As you can see from this Gartner graph they have predicted this trend. With the recession and acceptance of dynamic languages we have seen this accelerate beyond predictions.