I’ve been receiving a number of emails on this topic lately. It seems there is little information out there about how to move from development to production with a Flex and PHP application. Here is a simple checklist that could help you, especially if you are doing this for the first time. Please note that I presume you used the Data Services (wizards) to connect the Flex client to PHP services.
Make sure you have Zend Framework on your server. If you don’t, install it
Make sure you change MySQL credentials and server IP/name used by your PHP scripts to connect to the database
Copy the PHP services folder to your server. Then test these services. If they don’t work check the MySQL credentials or look for dependencies (maybe your PHP services use other PHP classes that you forgot to copy to your server)
Edit the amy_config.ini file and make sure the path to the Zend Framework is OK and set production to true
Edit the Flex services to point to your live server gateway.php. In the services folder of your Flex project you will find _Super_something.as files. In the constructor you will find a line like this:
_serviceControl.endpoint = “http://localhost:10088/MobileFlexPHP-PHP/public/gateway.php”; Copy that line and then open the class that extends this _Super class and paste the line in the constructor. Then change the URL to reflect your server setup
Copy the bin-release/ folder to your server (you should choose the export release for your project; this will create a SWF file smaller than the debug version)
That’s it! If I missed something please drop a comment!
As you might have heard, we released earlier this week Flash Builder and Flex 4.5. Part of this release is a new product called Flash Builder for PHP 4.5. This is something you should make sure you try if you are a PHP and Flash/Flex developer.
So what is Flash Builder for PHP? This product will install Flash Builder 4.5 with Zend Studio 8.1 as a plugin plus some additional plugins that integrate these two products. Using this IDE you can create mixed projects (Flex and PHP both for desktop and mobile devices) and you can streamline testing, deploying, debugging, and consuming PHP services via Flex remoting (with the help of Zend Framework).
Instead of writing a pretty long article, I decide to shoot a video tutorial on how you can create a Flex mobile app that uses a PHP service. This tutorial will walk you through:
Using the new project type Flex Mobile and PHP
Creating a mobile application that has two views/screens. I will explain how to use the ViewNavigator and View classes to control your application state
Consuming a PHP service from a Flex mobile app using remoting
Testing and debugging the code (Flex and PHP) on the desktop simulator and physical device
I hope you will enjoy this. If you want to download the files used for this tutorial, click here (unzip the file and you will get the Flex project you can import it and the PHP files plus the database dump).
I finally got some time to play with Doctrine 2 and Flex. Back in May I wrote an article about working with Doctrine 1.x and Flex (you can read the article here) and my feelings were mixed. I chatted with Jonathan Wage of Doctrine about some of the shortcomings I found in Doctrine 1.x and his response was to check Doctrine 2 (still in development at the time of writing this article). Doctrine 2 is a big step forward.
In this article I describe how I rewrote the original application I created for my first article, this time using Doctrine 2, Flex 4, Zend Framework, and the Flash Builder data-centric development wizards. I’ll highlight the relevant differences between Doctrine 1 and Doctrine 2 along the way. Thus, you should find this article valuable in any one of these two cases:
You are already working with Doctrine 1 and you’ve wondered what it would take to move to version 2
You want to learn how to use Doctrine 2 with Flex; you know PHP and you know enough Flex not to be scared away if you see some snippets of code
Before going into the details let me say this: if you aren’t already using an ORM framework for PHP then you should. For most projects it can help you by freeing you of the tedious tasks of writing CRUD code and SQL queries. It allows you to focus on the business logic of your application. And all these advantages are multiplied when working on Rich Internet Applications because on this kind of project much of the work is done on the client and not on the server.
There are some aspects of using this ORM with RIA that could be better, but hey we don’t live in a perfect world. Most of these things, I think, are related to the fact that every time you use a server side ORM with a rich client, you leave behind the main story used for creating that framework – you use the ORM in order to feed a rich client with data and enable the client to persist the changes. Thus you need additional boiler plate code to make the whole thing work.
If you don’t know much about ORMs in general, you may want to read my first article first and before continuing.
Later Update: If you are looking for an article rather on Doctrine 2 than Doctrine 1, then check this one.
This year I finally had the time to play with Doctrine (version 1.x) and Flex. Actually, it was more than playing; I’m using it for a real project that hopefully will enter production pretty soon. To summarize the experience in just a few words: it’s mind-blowing.
OK, I admit I may be exaggerating a little bit. Still, it is something that can change the way you build projects. Doctrine is an ORM (Object Relational Mapper) framework for PHP and it can really speed up the server side development when you have a lot of tables in your database.
In this article, I explore how to work with Doctrine on the server side, Flex on the client side, and remoting to communicate between Flex and PHP (using the Zend Framework for remoting on the PHP side). I also want to share with you some tools and workflows that can save you some time. While most things are fairly straightforward there are a number of tips and tricks that you may find useful if you decide to go down this road. (I will show you how to use plain vanilla value objects and how to handle dates just to give you two examples. Why reinvent the wheel?)
The application I’m going to build in this article is simple but the workflow is the same one I used with a much more complex application. Having said that let’s start by understanding the big picture.
I’ve just published a white paper on debugging Flex and PHP projects using Flash Builder 4, Eclipse PDT, and XDebug. You can read the article here.
In case you want to watch the webinar I did on the same subject today, you can go here. Thank you to all the people who joined my webinar!
PS. It seems we’ve come a long way when it comes to writing Flex applications. Out of 250+ registered people, only 60 decided to drop by. This is really good news, soon there will be no more bugs in our software :D
We’ve just launched Flash Builder 4, our latest IDE for building RIAs with Flex and ActionScript. If you use PHP on the server side, you may want to join my webinar on Debugging Flex and PHP projects.
I will talk about the new features of Flash Builder 4 that can help you while debugging and I will show how you can use Flash Builder 4 with Eclipse PDT and XDebug. The webinar will be this Wednesday (March 24th), 11AM Central European Time. You can register here.
As you know, one of my focuses as a Platform evangelist is Flex and PHP integration. Thus you can imagine I spend quite a lot of time doing Flex and PHP projects or research around these technologies. Lately I’ve been working on workflows for PHP and Flex (tooling, debugging, libraries) in light of the new tools (or new versions) we have been developing at Adobe. While some of these findings will see the light as articles, others are more intended as suggestions or feature request for upcoming versions of Flash Builder.
I’m really curious to find out:
What tools are you using?
What do you use for debugging?
What frameworks (AMFPHP, Zend Framework, Doctrine etc) do you use when working on Flex and PHP projects?
And the most important question: What features do you think Flash Builder needs in order to make you a happier/richer developer?
Please take some time and drop a comment with your thoughts around these questions.
And because I understand it takes some time to answer these questions, I want to give away three Flash Builder 4 licenses. I will choose randomly three lucky people from those who take the survey. The winners will be announced at the end of March, however you’ll get the licenses once we release Flash Builder 4 (now it is in Beta 2). Make sure you fill in your real name and a valid email address.
LATER EDIT: The winners of this raffle are: Mario Kralj, chandra shekhar pant, and Ben Dalton! Congratulations and pretty soon you’ receive the license.
On December 2nd, together with Roy Ganor from Zend, I will host an e-seminar about PHP and the Flash Platform. We will show you how you can create a Rich Internet Application using the Flex framework, Illustrator, Flash Catalyst, and Flash Builder 4. Then we will show you how to connect the Flex application to a PHP backend and how easy is to debug the PHP and Flex code using Zend Studio 7.1 and Flash Builder 4.
You can register for free here. The webinar will start at 6:00 PM Central European Time (9:00AM Pacific Standard Time) on December 2nd.
You can download the slides from here, and next week the recording will be available you can watch the recording over here (you need to have a Zend account).
Last week I visited Zend headquarters, and I had an interesting talk over there. One effect of this meeting is this: we will start to do webinars together with Zend.
If you want to find more about Zend Studio and other products related to PHP from Zend, or learn more about the integration between the Flash Platform and PHP (Flash Catalyst, Flash Builder, Flex framework) you shouldn’t miss this opportunity. I know that webinars don’t offer the same experience as in-person events. On the other hand, you can attend them from the comfort of your own home, there is no traveling involved and no need to convince your boss to let you attend the event.
We haven’t set the first event date yet, but it should be in the first week of December, and probably it will be in the evening (Central European Time).
Keep an eye on my blog for the exact date and time.