Short Bytes: Do you love to spend days and nights on your machine’s Terminal and getting things done? Here’s something that’ll give you a little fun break and allow you to play Game Boy titles right in your Terminal. Go ahead and learn how to run a Game Boy emulator in your Terminal using PHP.

If you are stuck in the world of bin and bash, trying to figure out a way to escape your machine’s Terminal, here’s how to take a quick break. If you know some basic UNIX commands and PHP, this quick and dirty method will help you play Pokémon and Mario inside your Terminal.

I found this Terminal Game Boy project on GitHub. To use this, your machine needs to be running at least PHP 5.6, 7, or HHVM. This Terminal emulator only works on Linux and Mac OS X. Based on Game Boy JS Emulator and making use of PHP7’s performance improvements, this project has become a fun way to kill some time.

Assuming that you’re having PHP installed on your system, I’ll tell you the commands that’ll install just a piece of software and make your machine ready for craziness.

Installing the Terminal Game Boy emulator:

Here are two ways to do this –

  • Installing the emulator using composer:
$ composer g require gabrielrcouto/php-terminal-gameboy-emulator:dev-master
  • Using it using PHAR:
$ wget https://raw.githubusercontent.com/gabrielrcouto/php-terminal-gameboy-emulator/master/bin/php-gameboy.phar
$ chmod +x php-gameboy.phar
$ mv php-gameboy.phar /usr/local/bin/php-gameboy

Running Game Boy emulator in Terminal:

By running the php-gameboy command, you need to load your game ROMs:

$ php-gameboy drmario.gb
$ php-gameboy pokemon.gbc

You can simply clone the directory and run the emulator locally and have more fun anytime:

$ git clone https://github.com/gabrielrcouto/php-terminal-gameboy-emulator.git
$ cd php-terminal-gameboy-emulator
$ composer install -o

For running ROMs of games, pass the full path of ROM and put in the php-terminal-gameboy-emulator folder:

$ bin/php-gameboy pokemon.gbc
$ bin/php-gameboy /full/path/to/your/rom/drmario.gb

Emulator controls in Terminal:

By pressing your keyboard keys, you can navigate in the game and save the world. Good luck!

  • Left = A
  • Up = W
  • Down = S
  • Right = D
  • A = Comma (,)
  • B = Dot (.)
  • Select = N
  • Start = M

Did you enjoy this PHP Terminal Game Boy emulator? Share your views in the comments below.

— via @gabrielrcouto

Get Free Sample Chapters: PHP, MySQL, JavaScript & HTML5 All-in-One For Dummies.