PHP code example of pd / database-info-panel

1. Go to this page and download the library: Download pd/database-info-panel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

pd / database-info-panel example snippets


class MyDatabaseInfoPanelStyleHandler implements Pd\Diagnostics\IDatabaseInfoPanelStyleHandler
{
	private $colors = array('db' => '#F30', 'db_staging' => '#F60', 'db_dev' => '#060', 'db_local' => '#00C');

	public function getStyle($databaseName, $params)
	{
		$style = array();
		if(array_key_exists($databaseName, $this->colors)) {
			$style[] = 'color: '.$this->colors[$databaseName];
		}
		if($databaseName === 'db') $style[] = 'font-weight: bold'; // production mode
		return implode('; ', $style);
	}

}