My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Featured
Downloads
Wiki pages
Links

PHP Tools for Manialink developers

ManiaLib is a lightweight PHP framework for Manialink and Web developement. It provides a set of object-oriented libraries to help you save time on classic Manialink (and Web) tasks. It is developed and supported by Ubisoft Nadeo.

Don't know what Manialinks are? Head to www.maniaplanet.com to discover all about Maniaplanet and its genres: TrackMania, ShootMania and QuestMania.

Latest release for Maniaplanet
ManiaLib 2.0.1

What can you do with ManiaLib?

ManiaLib is meant to be a very flexible framework that doesn't gte in the way of the developer. You can use ManiaLib in several ways, let's see some of them.

Basic toolkit

You can use ManiaLib as a toolkit so you can take advantage of its various little and helpful tools. For example if you need to get the current page URL, ManiaLib can do that for you:

<?php

require_once '/path/to/libraries/autoload.php';

$currentPage = \ManiaLib\Utils\URI::getCurrent();

?>

Advanced toolkit

You can use ManiaLib as an advanced toolkit and use some trickier features like the database abstract layer or the cache interface ; the latter provides a unified interface for using cache engines like APC, Memcached or MySQL-based cache:

<?php

require_once '/path/to/libraries/autoload.php';

// Working with PECL/Memcache extension:
$cache = \ManiaLib\Cache\Cache::factory(\ManiaLib\Cache\MEMCACHE);
$data = $cache->fetch('example');
if($data === false)
{
    $data = date('c');
    $cache->set('example', $data, 3600); // In cache for 3600s
}
echo $data;

?>

Manialink GUI toolkit

You can take advantage of the Manialink GUI toolkit, a powerful abstraction to create Manialink pages without writing any line of XML code:

<?php

use ManiaLib\Gui\Manialink;
use ManiaLib\Gui\Elements\Icons128x128_1;
use ManiaLib\Gui\Elements\Label;

require_once __DIR__.'/../libraries/autoload.php';

Manialink::load();

Manialink::beginFrame(-15, 0, 0);

$ui = new Icons128x128_1(10);
$ui->setValign('center');
$ui->setSubStyle(Icons128x128_1::Vehicles);
$ui->save();

$ui = new Label(40);
$ui->setValign('center2');
$ui->setPosition(12, 0, 0);
$ui->setStyle(Label::TextTitle1);
$ui->setText('Hello world!');
$ui->save();

Manialink::endFrame();

Manialink::render();

?>

ManiaScript UI framework

ManiaLib provides a ManiaScript framework and a PHP abstraction for it. It provides a simple event-driven architecture as well as some UI primitives (Dialogs, Tooltips) to make your Manialink pages more dynamic.

Work in progress. Need documentation? Ask for it in the forum!

Manialink application framework

You can use ManiaLib as a full-fledged Manialink (or Website) framework to take care of the all application architecture (using the classic MVC design pattern) and it's different abstractions (session, database, etc.)

Work in progress. Need documentation? Ask for it in the forum!

Legacy release for TrackMania Forever

You can still download ManiaLib 1 Beta, which was designed for TrackMania Forever. Head to the download tab.


Powered by Google Project Hosting