1. Go to this page and download the library: Download spirit55555/php-minecraft 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/ */
Spirit55555\Minecraft\MinecraftColors;
//Support for § and & signs
$text = '§4Lorem §3§lipsum §rdolor &nsit &c&mamet';
//Convert to HTML with CSS colors
echo MinecraftColors::convertToHTML($text);
//Same as above, but will replace \n with <br />
echo MinecraftColors::convertToHTML($text, true);
//Same as above, but will use CSS classes instead of inline styles
echo MinecraftColors::convertToHTML($text, true, true, 'mc-motd--');
//Will be compatible with the server.properties file
echo MinecraftColors::convertToMOTD($text);
//Will be compatible with BungeeCord's config.yml file
echo MinecraftColors::convertToMOTD($text, '&');
//Will also output RGB/HEX colors, if they exist (�)
//NOTE: Not supported in Vanilla Minecraft
echo MinecraftColors::convertToMOTD($text, '&', true);
//Same as above, but RGB/HEX in a long format (&x&0&0&0&0&0&0)
//NOTE: Not supported in Vanilla Minecraft
echo MinecraftColors::convertToMOTD($text, '&', true, true);
//Remove all color codes
echo MinecraftColors::clean($text);