How to programm in PHP your phone or android tablet

Miyazaki, 2022-11-23

First you will need to install Termux.
In Termux you run the following:

First if you haven't already, make it possible to access the phone drive from termux. This is optional.

ls storage
ls storage/shared

If you run those three commands, you will see the contents of your android phone. The folders in showing up in the second commands are shortcuts. The folders under storage/shared is the topmost directory on your phone.

Install PHP and libraries:

pkg upgrade
pkg install php openssl composer sqlite libxml2 libxslt git

You can now run PHP programs by typing "php index.php".

Let's get started with PHP Router:

git clone
cd phprouter
php -S routes.php

Open in the phone browser to see PHP router in action. You should see the word INDEX on the screen. Check out the code to learn more about PHPRouter. Here is my Fork and here is the documentation.

You can of course also install laravel, symfony or anything else! Yes, it's possible to programm in laravel on your android smartphone or android tablet! Or not use any framework!

You will probably want a text editor on your phone. You can either run one inside linux on termux or you use an android app and select the folder and file in the app. For blog posts, I use iA Writer, but there are editors like ACode which look promising. Consider using micro, nano, emacs or vim because you can use them on all other systems too.


You might be easier to install code server on a VPS to use vscode on android through a server. Gitpod/Github Codespaces is another option. Stay tuned for my article on that!

Learning PHP on your phone

See PHP: The Right Way