Coding in php on android

It turns out that coding in php on android is possible (even if its not as good as on a mac, linux or even windows). In this blog post I’ll go into some editors, IDE’s and other options for editing php code (and running a development LAMP stack) on your android devices.

Terminals

hackers keyboard is a must, if not for anything else it has arrow keys to help you navigate. You aren’t going to get sublime text (or vs code) multi cursors, but you at least want direction arrows on your keyboard.

termux is a must. If you have termux installed on your android device, then you can run ‘pkg install git’ to get your git command line utils. also ‘pkg install vim’ can help a ton too!

If you don’t want to run termux, then you can use Juicessh – however, you wont get as nice a local terminal. this is ok if you do all your work remotely, but you should just termux ssh – you can pkg install ssh and get a fully working openssh install of ssh in your android terminal that way.

Coding in php on android – git / scm / etc

openhub is a nice open source github client. It doesn’t let you directly clone repos, but it does let you copy the url so you can clone the repo form a terminal (see termux above) and you can browse commits, etc from inside the app.

Coding in php on android – PHP/ CSS / JS editors

AWD

AWD has support for syntax highlighting – I tried briefly on my multiloquent project (php, css, sass, less and js) and it seemed to recognise each filetype. I couldn’t find a way to ‘jump to definition (F12 in vs-code, or ctrl+click in sublime3)’ so I cant really say this is ready for full time production/operations in a web development agency, but it will be enough to save you if you are on the road and only have your android phone / tablet and have to rush a hot-fix into staging!

AWD has syntax highlighting for css files, but unfortunately doesn’t support less files (I didn’t try sass files, so your mileage may vary)

AWD also lets you clone from a git url, so if you are using AWD, you can clone directly into the app and start coding!

webmasters html editor lite
This was a surprisingly good editor (I thought its name sounded a little spammy) It had nice fonts, good highlighting and was clean and clear – the kind of things that you value after writing code for years (tbh the kind of things that vscode gets right)

droidedit
I like droidedit – it has a nice syntax highlight. it works with php files, it works with css files and it works with js files. I couldn’t get the ‘jump-to’ feature to work, but I couldn’t get it to work on AWD either. Droidedit doesn’t have a direct ‘clone from git’ feature that I could see, but I’m happy to run a couple of commands form the terminal each time I’m read for a commit anyway. I would say out of all the editors I tried, Droidedit is the one that I’ll keep around incase I need it.

anWriter

While I couldn’t get the code completion feature to work in anWriter, it did tell me that it was only available in the pro version. Code highlighting was present, but I don’t think this would be good for your eyes after 6 hours of coding. 

vim
If you have installed termux, then a simple ‘pkg install vim’ gives you a nice vim editor, where you can edit your php, js and css files.

Misc

Some developers like having LAMP stacks available to them (I’m talking about xamp, wamp, etc here, rather than a dedicated development machine, or vagrant box)

Server for PHP / Mariadb server seems to be the easiest combination I’ve found – they are separate apps, but let you start / stop a database server and an httpd with php. The php server is a nice app that also gives you a bit of control over what starts – you can enable / disable modules if needed and select php versions. (you might just use travis or jenkins to do automatic builds, but its nice to see whats happening to your code as you experiment)

debugging – I wouldn’t hold out for xdebug support while coding in php on android using editors I tried, A quick search in the app store for xdebug turned up a couple of things (Server for PHP was number 2)

Other coding in php on android things for interest:
microsoft azure has an app in the google play store.
plesk mobile has an app too.
wordpress app is always good (saves you opening in a browser).
aprox (a proxmox client) is available too.

coding in php on android references:
https://www.makeuseof.com/tag/best-4-html-editors-for-android-si/

https://play.google.com/store/apps/details?id=org.kidinov.awd&hl=en_GB

https://www.makeuseof.com/tag/create-perfect-php-development-environment-android/

You might want to root your device