



PC = PHP Classes (Manuel Lemos)

PFA = PHP For Android (Iván Mosquera Paulo)





PC: First of all, congratulations for your initiative to bring PHP to the Android platform.





Can you please start to talk a bit about yourself, who you are, where you work, what you do and your background in the PHP and Android scene?





PFA: I am Iván Mosquera. I am a software engineer at I am Iván Mosquera. I am a software engineer at Irontec . We are an Open Source company started 7 years ago. We are involved in a lot of Open Source projects with all kind of companies and government institutions. We develop our own VOIP solution based on Asterisk with an extra layer composed of several other projects.





Iván Mosquera Paulo is a lead developer of the PHP For Android project. He gave the following interview.









PHP is one of our regular tools. We have been a PHP company since our beginings. We are also working on our own PHP meta-framework called Karma . Apart from the PHP For Android project, I am also the lead developer of Evosugar (SugarCRM evolution integration plugin).





We are focusing on Open Source technologies, so Android is the obvious choice now. Last year we were involved in a few projects with Vodafone on which we developed a few Android apps in Java. However, our main tool is PHP. We knew about the existence of ASE (Android Scripting Environment). So we started working in supporting PHP For Android.





PC: Can you please describe a bit in more detail what is the goal of the PHP For Android project and why did you start it?





PFA: Yes, of course. Its first goal was providing support to ASE (Android Scripting Environment), recently renamed as SL4A (Scripting Layer for Android).





We were going to submit quite a big patch to achieve it, but it happened that the ASE folks were working in a refactoring. This refactoring was about making new interpreter support external to their project. That was when we thought about creating PHPForAndroid.net .





It is quite inspired on PHP.net . I mean, this project is not only about developing tools or apps. It is about helping PHP developers to get into the Android world for the first time without requiring to have a Java background.





So the first goal is achieved. It is already possible using PHP For Android with our unofficial ASE build and our PhpForAndroid-APK.





The next big thing is the script to APK issue. This is something killer in which the ASE (well, now S4LA) people are working and we are studying to support it and write documentation or tools ease it. Scripting for Android is no more geeky stuff thanks to the latest features.





We see a lot of potential in PHP For Android in custom apps like tracking your position and posting it depending in X conditions... The ASE API is quite big, the limit might be in the GUI but that is not really a problem in a lot of applications and we might work on improving that GUI API.





PC: It is interesting that you mentioned you work on Asterisk applications. There was a recent show in the TWIT network about FLOSS, on the It is interesting that you mentioned you work on Asterisk applications. There was a recent show in the TWIT network about FLOSS, on the Askozia PBX project which also uses PHP and jQuery to implement Asterisk appliances with user friendly Web interfaces.





But tell me, does the PHP For Android project allows PHP developers to build native Android applications, or is it something that still requires a Web server to run on the Android phone devices?





PFA: Our APK distributes a PHP-CLI binary, cross-compiled, linked to bionic (Android's libc) and just two extensions built-in, those required to talk to ASE: sockets and JSON . We may improve the binary with the help of the community of course.





So, no webserver required in Android. It is PHP-CLI and you have GUI access thanks to ASE's RPC server.





A frequently asked question is whether PHP-GTK is possible to run on Android. Well, AFAIK no because of the fact that Android lacks an X server.





PC: Interesting, but I just seen a video showing an implementation of KDE running on an Android device. Are you familiar with it?





PFA: I heard something about that but I am not sure if it is really being used.





We knew about ASE and we liked what the Python community already had. And we thought, why not? Lets go for PHP support.





Anyway, we are interested in other paths as well. It would be great having GTK for example.





PC: Right, X on Android devices is not a new thing, but I suppose that is not widely spread.





So, basically what does it take to have installed in Android phone to get PHP developers started?





PFA: We have put up a We have put up a screencast showing the current process. Firstly, you need to install our own ASE build because current ASE (r25) does not support the features needed by PHP For Android.





Once installed, it is time to install PhpForAndroid.apk. It is an Android app which installs: the PHP binary, our Android PHP class (ported from the Python) and a few PHP script samples.





Once PHP For Android is installed, you should have those scripts available on Android and they should work. The easiest way to test the API and having fun is including your own remote code.





All these steps can be watched in the screencast.





PC: Do PHP developers need to have real Android phones or are there any simulators that can be used to try PHP on Android?





PFA: Good question. No, you do not need a real Android phone. You can play with the Android emulator. We might provide more info on this in our wiki.





What you see in the screencast is the emulator with a skin.





If you have an Android phone you need to know that Android OS 1.5 is required.





PC: Are there any fees that developers need to pay to get access to SDKs and other developer materials to start working on PHP on Android applications?





PFA: No. They are free software: gratis y libre. (gratis y libre is Spanish, in English it is the same word for both things: free)





PC: So, if somebody builds an Android application in PHP what he/she needs to do to make the application available on Android App Store? Is it possible already? Do you provide any tools to assist in that process?





PFA: That is the next big thing. That is a feature ASE developers are working on and according to them, it is already working. We will see how it works and how easy it is for a PHP developer. We might provide tools and documentation to ease the process.





PC: I suppose that a PHP applications needs to also have installed your packages first in the Android device, right?





There are many Android devices in the market from different brands. Are the Android application installers device independent or do you need to have a specific PHP on Android runtime for each type of device?





PFA: All the current devices are ARM based and the PHP binary we provide is cross-compiled for ARM devices, so it should work out of the box on them. It is like an almost static PHP binary that you copy from a PC to another. It works and does not matter if it is AMD or Intel based.





We have heard about issues in ASE with a few devices but it is usually something related to a missing library, not really a common problem by now.





PC: Great. So in terms of developing PHP applications for Android, what is the current state of your project? Is it ready for starting developing interesting Android applications or only basic ones?





PFA: Now It is time to have fun. Try the ASE API, test our PHP binary, explore ASE's API limits. Once the script as APK feature is available we will be able to build Android apps with our code. Only basic ones? Well, it depends on Now It is time to have fun. Try the ASE API, test our PHP binary, explore ASE's API limits. Once the script as APK feature is available we will be able to build Android apps with our code. Only basic ones? Well, it depends on ASE's API , which is a bit basic about GUI stuff but very interesting on the backend.





Besides, there is another path which is mixing both aproaches.





TwoFortyFourAM for example, I think it uses Python scripts as backend. So you do not need a whole Java team to achieve it. We have worked with that logic in a few desktop projects. Building the view with Swing and using PHP scripts in the backend powered by Quercus. Adding scripting to a Java app can be an interesting approach.





PC: OK, can you give a few examples of interesting applications you can already develop in PHP with this project?





PFA: For example GPS logging and For example GPS logging and mctl . Well, mctl is our way to talk about a protocol used by Irontec when Jabi Infante and Gorka Gorrotxategi (CTO) went to Mongolia by car





You take your position via GPS and then you can send data using missed calls against a few DID numbers which represent binary encoded data. For example, you want to transfer the number 1 (0000001) so you can make a missed call to the first DID. It was a little bit complex because they had to start and stop the transfer, checksum and so on. It was a whole protocol :).





So, as I have said, you can already have fun with PHP For Android with ideas like this one.





PC: Great, sounds like you implemented some advanced hacks.





Another question, most PHP applications are MySQL based. Is MySQL already available, or at least SQLite, for use in PHP Android applications?





PFA: I don't think so. I don't know whether there is some kind of database storage exposed by the ASE API. Anyway, Android phones are usually Internet based, so you can think of PHP For Android in a role like JavaScript in Web applications, you can call server code.





And this is related to the built-in extensions on PHP. We want to keep the binary as light as possible but the discussion is open.





PC: Right, I guess at least SQLite can be shipped built-in because it is very simple and does not require any external servers or libraries.





Now a bit on the market and business opportunities. The Android phone market seems to have exploded lately in reach. We hear about 5 million Android smart phones of many different brands being sold around the world just in the last month.





Do you think your project can represent a good opportunity for the developers to make even more money selling Android applications or providing other services, than they would doing regular PHP Web applications? What is your guess?





PFA: I hope so. Apple does not want PHP developers, they want you to invest in their technology. With Android, you have freedom of choice: Java, AIR, scripting (Python, now PHP,...).





Besides, a lot of Web developers might try Android development thanks to PFA. They can reuse their current know-how.





PC: Good. Another commercial concern, I suppose your project requires PHP applications to be installed with PHP code. Commercial developers would have concerns about customers ripping their PHP code.





Do you recommend any solution for protecting the PHP applications source code from being stollen or altered? Do you think for instance Facebook's Hip-Hop PHP to C++ compiler could be used to solve that problem?





PFA: Well, we are an Open Source company. So we are not really worried about that. However I understand that there might be people interested in using a different commercial policy. Hip-Hop, can be interesting. Obfuscation is sometimes used in Web development. Anyway, we recommend a more open policy.





PC: OK. So, what are your immediate plans for the future of this project?





PFA: We want people involved in sharing scripts, testing, discussion, learning ASE's API, have fun. The script as APK feature provided by SL4A will be the next big thing.





PC: Are you looking for help in your project? If so, what other developers can do to join you and help evolving the project faster?





PFA: Any PHP developer can help sharing scripts. We will give them credit, of course. Besides, testing is needed, and documentation, we want to have some kind of PFA official manual.





Speaking about the internals, a bit Java and PHP compiling knowledge may be necessary, maybe a bit of C too. However, I think that this is not so important now. We can already work with the current release.





PC: Great. Is there anything else you would like to say besides what was asked, maybe how other developers or companies can get in touch with your company?





PFA: You can get in touch with our company via email (info at irontec.com). Besides that, we usually talk about the things we do in You can get in touch with our company via email (info at irontec.com). Besides that, we usually talk about the things we do in our blog Irontec's Twitter account is also very active.





For contacting about PHPForAndroid project, the best way is to join the project mailing list





PC: Thank you very much for this interview. Good luck for your project.





PFA: Thanks, great interview.