SlideShare a Scribd company logo
1 of 32
Flex and PHP – For the Flash Folks Kevin Schroeder Zend Technologies
Join us at ZendConThe premier PHP conference!October 17-19, 2011 – Santa Clara, CA Conference Themes Cloud Computing Learn about the latest developments in PHP Cloud infrastructure, management and application services Mobile and User Experience Learn how to build engaging mobile apps with the latest PHP technologies and tools Enterprise and Professional PHPExplore PHP best practices, new technologies and practical tips with industry experts Conference Highlights ,[object Object]
Sessions designed for all knowledge levels
Intensive tutorials for accelerated learning
PHP Certification crash courses and testing
Exhibit hall showcasing the latest products
Special networking opportunities during meals and eventswww.zendcon.com
   About self::$me  Past: Programming/Sys Admin  Current: Technology Evangelist/Author/Composer          @kpschrade
Assumptions (rightly or wrongly) You know Flash You know about Flash Builder  You have heard about Flash Builder for PHP You don’t know, or think you know, PHP  You do not know Zend Framework
PHP is written in C and written for the web If you wonder why PHP does something a certain way the answer will probably be found in one of those two places
PHP Dynamically typed language (not un-typed/typeless) Variable values may be modified base on context $data = “1two3four5”; can be worked upon as a string, integer, float or boolean. Isn’t that kind of weird?  Nope.  See any integers? GET /?data=1two3four5&data2=1 HTTP/1.1 Host: corp Connection: keep-alive Content-Length: 0 User-Agent: Mozilla/5.0 (Windows NT 6.0; WOW64) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.68 Safari/534.24 Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Data types String Integer Float Boolean Object Resource Array NULL
Language Features Object Oriented Programming or Procedural (or both) Namespaces Exceptions Reflection A dozen protocols or wrappers accessible to FS ops Wide range of APIs Web Services XML Processing (DOM & Expat) Databases Huge number of frameworks Huge number of applications
Functions ,[object Object],* Only objects or arrays Declaration (no return type) Required parameter Optional parameter Parameter class type * Returning a value
Objects/Classes Namespace Separator is br />Namespace Declaration (PHP 5.3+) Extending a class Class Properties Magic/reserved method names Static Context No return type Calling a static element
Application Structure/Behavior (Autoloading) Class files need to be explicitly require()d unless you use an autoloader Use an autoloader Registered with the __autoload() method  If a class does not exist in the current request, it will be called to load the class file Will equal “MyClass1”
Application Structure/Behavior (Autoloading) Don’t bother writing your own. FBPHP already includes Zend Framework which has one MyClass1.php needs to be in the include_path
Application Structure/Behavior (Autoloading) Mapping class names to files Class files must be in the include_path Both map to Zend/Lib/MyClass.php PHP 5 Pseudo namespaces PHP 5.3+ Namespaces
Database Access Extensions (mysql, mysqli, sqlsrv, oci8, etc.) PDO (pdo_mysql, pdo_sqlite, pdo_ibm, etc.) Don’t create a DB connection in your general purpose classes Use dependency injection Use a singleton/factory/adapter
Deployment PHP does not have a “required” binary distribution format like SWF, APK, IPA, etc. Zend Server 5.5 beta has a new deployment feature w/ package format Application is deployed as source code Deployed source files should generally be kept out of the public document root Configuration files should definitely be kept out of the document root
Flash/Flex Projects
Creating a project ( w/ PHP )
Tie two projects together Enable support Set your directories Select the PHP project
Remoting
Zend Framework PHP-based framework managed by Zend Technologies Framework/Component library DB access/modeling Service layer Authentication/ACLs MVC A TON more Used as the supported mechanism for access PHP-based services in Flash Builder for PHP
Action Message Format Protocol for serializing objects to/from a Flash player Supports strong typing of data Support in multiple languages Support for any binary transport that ActionScript supports Two versions AMF0 AMF3
Zend_Amf A Zend Framework based component to facilitate connections to Flash Two mechanisms Direct Serializer Used for non-service endpoints (SMTP, Stomp, File System) Generally not what you will use Zend_Amf_Server Used for service-based endpoints Manages calls to service classes similar to MVC Generally what you will use
Direct Serializer Create an object Create the output stream Create the serializer Write the object Get the output from the stream Weird,  but required
Reading the (PHP) serialized object Not just for PHP! Regular binary data Magic!
PHP Application Building a Service Oriented Architecture Flash Application Service Call 1 Service Call 3 HTTP Gateway Service Class 1 Service Class 2 Service Class 3 Service Class 4
Steps Create value object classes to represent data Use PHPDoc to document data types Create a service class to provide access Use PHPDoc to document return types Create the service in Flash Builder Drag-n-drop services onto bindable components or create them directly using ActionScript Profit!
A Simple Architecture Libraries and Value Objects* Document Root Services to expose */services is not in the include_path, otherwise value objects would go there

More Related Content

What's hot

Concepts of Asp.Net
Concepts of Asp.NetConcepts of Asp.Net
Concepts of Asp.Net
vidyamittal
 
Summer Training In Dotnet
Summer Training In DotnetSummer Training In Dotnet
Summer Training In Dotnet
DUCC Systems
 
Nakov - .NET Framework Overview - English
Nakov - .NET Framework Overview - EnglishNakov - .NET Framework Overview - English
Nakov - .NET Framework Overview - English
Svetlin Nakov
 
Visual Studio .NET2010
Visual Studio .NET2010Visual Studio .NET2010
Visual Studio .NET2010
Satish Verma
 

What's hot (20)

.NET and C# Introduction
.NET and C# Introduction.NET and C# Introduction
.NET and C# Introduction
 
Concepts of Asp.Net
Concepts of Asp.NetConcepts of Asp.Net
Concepts of Asp.Net
 
Visual Studio.NET
Visual Studio.NETVisual Studio.NET
Visual Studio.NET
 
Summer Training In Dotnet
Summer Training In DotnetSummer Training In Dotnet
Summer Training In Dotnet
 
Nakov - .NET Framework Overview - English
Nakov - .NET Framework Overview - EnglishNakov - .NET Framework Overview - English
Nakov - .NET Framework Overview - English
 
ASP.NET 01 - Introduction
ASP.NET 01 - IntroductionASP.NET 01 - Introduction
ASP.NET 01 - Introduction
 
AtoM Data Migrations
AtoM Data MigrationsAtoM Data Migrations
AtoM Data Migrations
 
ASP.NET Basics
ASP.NET Basics ASP.NET Basics
ASP.NET Basics
 
DOT Net overview
DOT Net overviewDOT Net overview
DOT Net overview
 
dot net technology
dot net technologydot net technology
dot net technology
 
Visual Studio .NET2010
Visual Studio .NET2010Visual Studio .NET2010
Visual Studio .NET2010
 
Dot Net Framework
Dot Net FrameworkDot Net Framework
Dot Net Framework
 
dot NET Framework
dot NET Frameworkdot NET Framework
dot NET Framework
 
Building scalable and language-independent Java services using Apache Thrift ...
Building scalable and language-independent Java services using Apache Thrift ...Building scalable and language-independent Java services using Apache Thrift ...
Building scalable and language-independent Java services using Apache Thrift ...
 
C# advanced topics and future - C#5
C# advanced topics and future - C#5C# advanced topics and future - C#5
C# advanced topics and future - C#5
 
VB.net
VB.netVB.net
VB.net
 
.Net programming with C#
.Net programming with C#.Net programming with C#
.Net programming with C#
 
Architecture of .net framework
Architecture of .net frameworkArchitecture of .net framework
Architecture of .net framework
 
CSV import in AtoM
CSV import in AtoMCSV import in AtoM
CSV import in AtoM
 
Unmanged code InterOperability
Unmanged code InterOperabilityUnmanged code InterOperability
Unmanged code InterOperability
 

Viewers also liked

Application Deployment with Zend Server 5.5 beta
Application Deployment with Zend Server 5.5 betaApplication Deployment with Zend Server 5.5 beta
Application Deployment with Zend Server 5.5 beta
10n Software, LLC
 
Delaying Gratification: Using queues to build efficient systems
Delaying Gratification: Using queues to build efficient systemsDelaying Gratification: Using queues to build efficient systems
Delaying Gratification: Using queues to build efficient systems
10n Software, LLC
 
PHP Performance: Principles and tools
PHP Performance: Principles and toolsPHP Performance: Principles and tools
PHP Performance: Principles and tools
10n Software, LLC
 

Viewers also liked (7)

Application Deployment with Zend Server 5.5 beta
Application Deployment with Zend Server 5.5 betaApplication Deployment with Zend Server 5.5 beta
Application Deployment with Zend Server 5.5 beta
 
Do you queue (updated)
Do you queue (updated)Do you queue (updated)
Do you queue (updated)
 
Delaying Gratification: Using queues to build efficient systems
Delaying Gratification: Using queues to build efficient systemsDelaying Gratification: Using queues to build efficient systems
Delaying Gratification: Using queues to build efficient systems
 
10 things
10 things10 things
10 things
 
PHP Performance: Principles and tools
PHP Performance: Principles and toolsPHP Performance: Principles and tools
PHP Performance: Principles and tools
 
Best Practices in PHP Application Deployment
Best Practices in PHP Application DeploymentBest Practices in PHP Application Deployment
Best Practices in PHP Application Deployment
 
Continuous Integration and Deployment Best Practices on AWS
Continuous Integration and Deployment Best Practices on AWS Continuous Integration and Deployment Best Practices on AWS
Continuous Integration and Deployment Best Practices on AWS
 

Similar to Flex and PHP For the Flash Folks (20)

Flex for php developers
Flex for php developersFlex for php developers
Flex for php developers
 
Simplify your professional web development with symfony
Simplify your professional web development with symfonySimplify your professional web development with symfony
Simplify your professional web development with symfony
 
first pitch
first pitchfirst pitch
first pitch
 
werwr
werwrwerwr
werwr
 
sdfsdf
sdfsdfsdfsdf
sdfsdf
 
college
collegecollege
college
 
first pitch
first pitchfirst pitch
first pitch
 
Greenathan
GreenathanGreenathan
Greenathan
 
Unit Test for ZF SlideShare Component
Unit Test for ZF SlideShare ComponentUnit Test for ZF SlideShare Component
Unit Test for ZF SlideShare Component
 
first pitch
first pitchfirst pitch
first pitch
 
organic
organicorganic
organic
 
first pitch
first pitchfirst pitch
first pitch
 
latest slide
latest slidelatest slide
latest slide
 
345
345345
345
 
before upload
before uploadbefore upload
before upload
 
Unit Test for ZF SlideShare Component
Unit Test for ZF SlideShare ComponentUnit Test for ZF SlideShare Component
Unit Test for ZF SlideShare Component
 
werwer
werwerwerwer
werwer
 
before upload
before uploadbefore upload
before upload
 
latest slide
latest slidelatest slide
latest slide
 
sdfsd
sdfsdsdfsd
sdfsd
 

More from 10n Software, LLC (9)

Creating stunning data analytics dashboard using php and flex
Creating stunning data analytics dashboard using php and flexCreating stunning data analytics dashboard using php and flex
Creating stunning data analytics dashboard using php and flex
 
Php security common 2011
Php security common 2011Php security common 2011
Php security common 2011
 
North east user group tour
North east user group tourNorth east user group tour
North east user group tour
 
Slideshare - Magento Imagine - Do You Queue
Slideshare - Magento Imagine - Do You QueueSlideshare - Magento Imagine - Do You Queue
Slideshare - Magento Imagine - Do You Queue
 
Do you queue
Do you queueDo you queue
Do you queue
 
Zend Server - OSI Days
Zend Server - OSI DaysZend Server - OSI Days
Zend Server - OSI Days
 
Zend Framework Workshop
Zend Framework WorkshopZend Framework Workshop
Zend Framework Workshop
 
Slides from LAX & DEN usergroup meetings
Slides from LAX & DEN usergroup meetingsSlides from LAX & DEN usergroup meetings
Slides from LAX & DEN usergroup meetings
 
Flex and Zend Framework
Flex and Zend FrameworkFlex and Zend Framework
Flex and Zend Framework
 

Recently uploaded

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Recently uploaded (20)

Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 

Flex and PHP For the Flash Folks

  • 1. Flex and PHP – For the Flash Folks Kevin Schroeder Zend Technologies
  • 2.
  • 3. Sessions designed for all knowledge levels
  • 4. Intensive tutorials for accelerated learning
  • 5. PHP Certification crash courses and testing
  • 6. Exhibit hall showcasing the latest products
  • 7. Special networking opportunities during meals and eventswww.zendcon.com
  • 8. About self::$me Past: Programming/Sys Admin Current: Technology Evangelist/Author/Composer @kpschrade
  • 9. Assumptions (rightly or wrongly) You know Flash You know about Flash Builder You have heard about Flash Builder for PHP You don’t know, or think you know, PHP  You do not know Zend Framework
  • 10. PHP is written in C and written for the web If you wonder why PHP does something a certain way the answer will probably be found in one of those two places
  • 11. PHP Dynamically typed language (not un-typed/typeless) Variable values may be modified base on context $data = “1two3four5”; can be worked upon as a string, integer, float or boolean. Isn’t that kind of weird? Nope. See any integers? GET /?data=1two3four5&data2=1 HTTP/1.1 Host: corp Connection: keep-alive Content-Length: 0 User-Agent: Mozilla/5.0 (Windows NT 6.0; WOW64) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.68 Safari/534.24 Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
  • 12. Data types String Integer Float Boolean Object Resource Array NULL
  • 13. Language Features Object Oriented Programming or Procedural (or both) Namespaces Exceptions Reflection A dozen protocols or wrappers accessible to FS ops Wide range of APIs Web Services XML Processing (DOM & Expat) Databases Huge number of frameworks Huge number of applications
  • 14.
  • 15. Objects/Classes Namespace Separator is br />Namespace Declaration (PHP 5.3+) Extending a class Class Properties Magic/reserved method names Static Context No return type Calling a static element
  • 16. Application Structure/Behavior (Autoloading) Class files need to be explicitly require()d unless you use an autoloader Use an autoloader Registered with the __autoload() method If a class does not exist in the current request, it will be called to load the class file Will equal “MyClass1”
  • 17. Application Structure/Behavior (Autoloading) Don’t bother writing your own. FBPHP already includes Zend Framework which has one MyClass1.php needs to be in the include_path
  • 18. Application Structure/Behavior (Autoloading) Mapping class names to files Class files must be in the include_path Both map to Zend/Lib/MyClass.php PHP 5 Pseudo namespaces PHP 5.3+ Namespaces
  • 19. Database Access Extensions (mysql, mysqli, sqlsrv, oci8, etc.) PDO (pdo_mysql, pdo_sqlite, pdo_ibm, etc.) Don’t create a DB connection in your general purpose classes Use dependency injection Use a singleton/factory/adapter
  • 20. Deployment PHP does not have a “required” binary distribution format like SWF, APK, IPA, etc. Zend Server 5.5 beta has a new deployment feature w/ package format Application is deployed as source code Deployed source files should generally be kept out of the public document root Configuration files should definitely be kept out of the document root
  • 22. Creating a project ( w/ PHP )
  • 23. Tie two projects together Enable support Set your directories Select the PHP project
  • 25. Zend Framework PHP-based framework managed by Zend Technologies Framework/Component library DB access/modeling Service layer Authentication/ACLs MVC A TON more Used as the supported mechanism for access PHP-based services in Flash Builder for PHP
  • 26. Action Message Format Protocol for serializing objects to/from a Flash player Supports strong typing of data Support in multiple languages Support for any binary transport that ActionScript supports Two versions AMF0 AMF3
  • 27. Zend_Amf A Zend Framework based component to facilitate connections to Flash Two mechanisms Direct Serializer Used for non-service endpoints (SMTP, Stomp, File System) Generally not what you will use Zend_Amf_Server Used for service-based endpoints Manages calls to service classes similar to MVC Generally what you will use
  • 28. Direct Serializer Create an object Create the output stream Create the serializer Write the object Get the output from the stream Weird, but required
  • 29. Reading the (PHP) serialized object Not just for PHP! Regular binary data Magic!
  • 30. PHP Application Building a Service Oriented Architecture Flash Application Service Call 1 Service Call 3 HTTP Gateway Service Class 1 Service Class 2 Service Class 3 Service Class 4
  • 31. Steps Create value object classes to represent data Use PHPDoc to document data types Create a service class to provide access Use PHPDoc to document return types Create the service in Flash Builder Drag-n-drop services onto bindable components or create them directly using ActionScript Profit!
  • 32. A Simple Architecture Libraries and Value Objects* Document Root Services to expose */services is not in the include_path, otherwise value objects would go there
  • 33. Integrating into your own application Define service classes Bootstrap your application Call Zend_Amf_Server
  • 34. Handling authentication Implements Zend_Auth_Adapter_Interface Create a simple auth adapter Generic identity class Add to gateway Add role to server ACL Allow only the logged in role Identity object requires “role” property
  • 35. Handling Authentication (in Flash) Set credentials for the service call Call the service
  • 36. Method-level ACLs Add method-specific resource Tell Zend_Amf_Server that the ACL needs to be checked against Explicitly allow for guests Already allowed for logged in users
  • 37. Demo : Creating and binding a PHP endpoint (slides would mean endless screen shots that would result in… well… this: