As the name of this project is it's just a simple php script which allows you to create custom banners for your minecarft server. These are live banners so they display live stats of your server. At the moment they display the address of your server, the amount of online players and the version of the server.
But you may configure these options in the banner.php
file.
- You can now access the banner generator by going to
yourdomain.com/banner/panel/index.php
! - For prettier urls you can make a request without include the file's extension (Instead of banner.php?address=localhost:25565 you can simply just banner?address=localhost:25565) but you must have the
.htaccess
file in the projects root folder. - This project also includes a server query using mcsrvstat.us api.
- If you enable the
enable_key
option in the config file you can restrict the usage of the banner generator but then you must need to pass the following value for the future request's:&key=your_app_key
. You can find theapp_key
in theconfig.php
file. If you want to use it it's recommended to change it frequently but the actual usage of it is to disable the momentary usage of the generator. - Since adding a preset requires to provide the projects
app_key
every time you want to create a preset you can specify theapp_key
in the url and that way you can create presets easily. (Example: yourdomain.com/banner/panel/index.php?app_key=your_app_key) - All the presets are stored in the
presets.json
file if you set thepreset-driver
in theconfig.php
to file and make please do not edit thepresets.default.json
. - This project includes 8 default banners (1-8) and 3 default fonts (Roboto, Ubuntu, Minecraftia)
- Some images are used from Reign [512x]! by Tanner77.
- Drag all the files included form the downloaded zip in to a folder and after the go to the
config.php
and change theapp_url
fromhttp://localhost/banner/
to the domain for the banner generator. - Go to
yourdomain.com/banner/panel/index.php?build_schema=1
(Only if you want your presets to be loaded from a database)
- You can get a custom banner by accessing:
banner?address=your_minecraft_server_ip&background=1&font=roboto&color=27AE60&type=1
- You can access the server query by:
query?address=your_minecraft_server_ip
- Note 1: You can now simply request a banner by
banner?address=your_minecraft_server_ip
and the default settings in theconfig.php
will be applied. - Note 2: Now you can also choose from 3 predefined styles for the banner (type), the default type for the banner is 1. Example:
banner?address=your_minecraft_server_ip&type=2
The banner's resolution must be 468x60 and it must a jpg
file and included in the img/background
folder with the following name: banner_(here a custom number).jpg
, example: banner_11.jpg
. You can set the background of the banner by changing the background
variable for example: banner?address=your_minecraft_server_ip&background=11&font=roboto
.
First you need to add a add your font file to the fonts
folder and rename it like this: examplefont-regular.ttf
after this go to the config.php
and add it to the fonts
and the name you specify there should be just the font's name without the -regular.ttf and you must make sure it's all lowercase (The name specified in the config and the actual name of the font file must be all lowercase). And now you can change the font by simply changing the font
variable in the request url for example: banner?address=your_minecraft_server_ip&background=1&font=your_custom_font
.
- You can request a custom banner specified in the
presets.json
like this:banner?preset=hypixel
(This is the default banner preset in thepresets.json
and you can use it as an example) - You can add a new preset in the
presets.json
or via the new banner generator panel by clicking on the "Create Preset" button.
<?php
$config = [
'app_key' => 'K6TdeFXHuqZC7Fam', // Please change this to whatever your want (Do not leave this as default!)
'enable_key' => false,
'query_api' => 'https://api.mcsrvstat.us/2/',
'app_url' => 'http://localhost/banner/',
'enable_htaccess' => false,
'fonts' => ['ubuntu', 'roboto', 'minecraftia'],
'type_list' => [1, 2, 3],
'defaults' => [
'font' => 'minecraftia',
'color' => '#fff',
'background' => 1,
'type' => 1
],
'database' => [
'host' => 'localhost',
'database' => 'database',
'username' => 'root',
'password' => '',
'prefix' => 'banner_',
],
'preset-driver' => 'file' // Driver Types: file, database
];
- Banner:
http://localhost/banner/banner?address=mc.hypixel.net
(Note: you may specify other parameters likename
,font
,type
,background
orcolor
) - Query:
http://localhost/banner/query?address=mc.hypixel.net
# nginx configuration
autoindex off;
location / {
if (!-e $request_filename){
rewrite ^/([^\.]+)$ /$1.php break;
}
}