Monday, March 13, 2017

The Android Elephpant – Laravel on your Android Phone?

It was not that long ago that [Christopher Pitt](http://ift.tt/29ewQai) wrote an excellent article about [writing and running PHP code on an iPad](http://ift.tt/2eLkg5z). After reading it, I thought to myself "It would be really cool to do the same on Android": being able to write and edit code on the fly, for example while traveling, and not having to take the laptop everywhere. So I've decided to do some research and see what I could come up with.

![Android Elephpant](http://ift.tt/2nlYrxc)

For this article, you can use any type of Android device. I've done it on my phone, but an Android tablet with a Bluetooth keyboard would probably be the ideal setup.

There are a couple of different shell apps for Android. For this tutorial we will use one called [Termux](https://termux.com/).

![Termux](http://ift.tt/2mSELTM)

Termux combines both a powerful terminal emulation and an extensive Linux package collection. It is also completely free and easy to use.

After installing Termux from the Play Store, the first thing to do is to run the `apt update` command. As per the [documentation](http://ift.tt/2kpq2LS): *"This command needs to be run initially directly after installation and regularly afterwards to receive updates."*

Now for the fun part. The first two commands I want to talk about are the `apt list` and `apt list --installed` commands. The first one will list all the available packages for Termux. We can see that it has support for a lot of different programming languages, text editors and has some useful utility packages like zip, tar and so on. The second command will list all the installed packages. As we can see Termux already comes with some packages like apt and bash pre-installed.

My goal when testing Termux was to see if I could assemble a proper PHP development environment, so I started by installing a text editor. I prefer Vim, but there are some more options available, like Emacs and Nano. Vim has a bit of a learning curve to it, but it gets very comfortable when you get past the basics of it. You can get Vim with the `apt install vim` command.

If you want to learn more about vim, there's [this very good article](http://ift.tt/2fWiWQa) or, alternatively, after installing it, type `vimtutor` to use the built-in tutorial.

Continue reading %The Android Elephpant – Laravel on your Android Phone?%


by Claudio Ribeiro via SitePoint

No comments:

Post a Comment