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 (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 beta10n 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 systems10n Software, LLC
 
PHP Performance: Principles and tools
PHP Performance: Principles and toolsPHP Performance: Principles and tools
PHP Performance: Principles and tools10n Software, LLC
 
Best Practices in PHP Application Deployment
Best Practices in PHP Application DeploymentBest Practices in PHP Application Deployment
Best Practices in PHP Application DeploymentShahar Evron
 
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 Amazon Web Services
 

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

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
 
sadasd
sadasdsadasd
sadasd
 
asdfasd
asdfasdasdfasd
asdfasd
 
before upload
before uploadbefore upload
before upload
 
before upload
before uploadbefore upload
before upload
 

More from 10n Software, LLC

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 flex10n Software, LLC
 
Slideshare - Magento Imagine - Do You Queue
Slideshare - Magento Imagine - Do You QueueSlideshare - Magento Imagine - Do You Queue
Slideshare - Magento Imagine - Do You Queue10n Software, LLC
 
Slides from LAX & DEN usergroup meetings
Slides from LAX & DEN usergroup meetingsSlides from LAX & DEN usergroup meetings
Slides from LAX & DEN usergroup meetings10n Software, LLC
 

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

Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 

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: