special sponsors

Add Themes to phpMyAdmin 4.x

Written by: Jace Bennest Jace Bennest
Guide Tested: Yes

phpMyAdmin is a free software tool written in PHP, intended to handle the administration of MySQL over the Web. See the lando docs regarding phpMyAdmin for help enabling the service.

Only for PhpMyAdmin 4.x

Note that this guide is only applicable to the 4.x branch of PhpMyAdmin. You'll want to consult the docs for how to do this in 5.x

This is a basic setup to help you enable extra themes.

Getting Started

Add the build script to your Lando recipe where you should have the phpMyAdmin service already.

services:
  pma:
    type: phpmyadmin:4.7
    build_as_root:
      - chmod +x /app/.lando/pma-theme.sh
      - /app/.lando/pma-theme.sh

Create script to download and install the third-party theme

Create the custom pma-theme.sh file.

touch .lando/pma-theme.sh
vim .lando/pma-theme.sh

The location of this file is arbitrary. We placed it inside .lando/ folder simply because we find it convenient.

#!/bin/sh
if [ ! -z $LANDO_MOUNT ]; then
  wget https://files.phpmyadmin.net/themes/pmaterial/1.1/pmaterial-1.1.zip
  unzip pmaterial-1.1.zip -d /www/themes/
  rm pmaterial-1.1.zip
fi

Checkout the available themes here. Make sure you choose a theme compatible with your version of phpMyAdmin. Modify the script according to the theme you want.

Set new theme as the default

Review the phpMyAdmin docs to see how to hook up your config file.

Add this line to your config:

<?php
  ...

  // Set whichever theme you have available here.
  $cfg['ThemeDefault'] = 'pmaterial';

  ...

Rebuild your environment

lando rebuild -y

Done!

Check the output from lando or run lando info to get the url for the phpMyAdmin service.

FULL CODE EXAMPLE!

If you are interested in checking out the fully-armed and operational source code for this guide then check out this repo here.

Have a Lando question you'd like to see as a guide? Suggest one!
Want to write a Lando guide? Learn how!