Page 1 of 2

[TMF] ManiaLib 2.0 preview

Posted: 16 Dec 2010, 13:44
by gouxim
Hey fellow coders,

Although we just released version 1.0b of ManiaLib, we are already using a new 2.0 version at Nadeo.

I just imported it in the trunk of our svn, so if you are intersted you can checkout the trunk. Beware though, it's is an experimental version: quickly changing codebase, no documentation, use of extensions such as APC, etc.

http://code.google.com/p/manialib/source/checkout

Re: ManiaLib 2.0

Posted: 16 Dec 2010, 13:57
by gouxim
If anyone is interested, we can make a alpha zip package out of it.

Re: ManiaLib 2.0

Posted: 17 Dec 2010, 17:53
by w1lla
im interested to see how it has become...

Re: ManiaLib 2.0

Posted: 17 Dec 2010, 18:44
by gouxim
If you juste want to take a look, you can browse the code online:
http://code.google.com/p/manialib/source/browse/ (2.0 is currently the trunk/)

I can give you a quick summary of the architecture.
We are now using "fake namespaces" like what you can find on PEAR or in the Zend Framework for example.

Basically there's is a "libraries" folder which contains all the code, and ALL the code is made of classes.
It works like packages.

For example:
/libraries/ManiaLib/Database/Connection.php
contains the class called
ManiaLib_Database_Connection

It helps a lot organizing the code, and the fact that the class names are that long is not too much of a problem with auto-completion feature of Eclipse PDT.

When you create your Manialink, your are going to put evrything in a package. For example, we created the ManiaLibDemo package that contains all the code of the manialink "manialib":

http://code.google.com/p/manialib/sourc ... iaLibDemo/

When we write our views, the long names where actually a problem, so we created some shortcut classes (when we have migrated to PHP 5.3, this won't be a problem anymore with true namespace support, but for now we are stuck with 5.2):

For example instead of always writing:
"new ManiaLib_Gui_Elements_Quad()"
we use:
"new Quad()"
and Quad is just a class that extends ManiaLib_Gui_Elements_Quad

It also helps a bit with backward compatibility (well, we still broke pretty much everything to get the new architecture in place).

If you want to use the new version, you can "at your own risk": no documentation, the code is evolving very fast and we may break stuff at any time. The 1.0 is branch is more stable. In any case, don't hesitate to ask in a thread in this forum if you have technical questions (whether they are on the 1.0 or 2.0 branch), i am sure it will help others.

Let me know if your are intersted in a ZIP package of the 2.0 to work with it.

Re: ManiaLib 2.0

Posted: 17 Dec 2010, 19:19
by w1lla
could you post the 2.0 alpha package so i can give it a try.

Re: ManiaLib 2.0

Posted: 20 Dec 2010, 19:17
by gouxim
Allright. I still have a couple of bugs to fix, I'll release a preview package in a couple of days.

Re: ManiaLib 2.0

Posted: 27 Dec 2010, 18:44
by gouxim
Hey there,

I added a preview package of ManiaLib 2.0 here: http://code.google.com/p/manialib/downloads/list

Here's some instructions for anyone interested in testing it. It must emphasize the fact that it is a preview package, so there's no doc, there's no guarantee it's working and it requires some good knowledge in PHP and OOP.

WARNING!!!
Protect your /config folder so that people can NOT access it throught HTTP
(with a .htaccess file for example)
If you don't do that, people will be able to download your INI config file and see, for example, your database credentials.

Requirements:
* PHP 5.2+
* PHP APC extension (or another cache extension, but you will need to write a driver in ManiaLib/Cache/Driver

How to make it work
* Create a namespace for your application (you can look at the ManiaLibDemo example)
* Edit config/app.ini to match your app

How to stay up to date
Do not modifiy anything in /ManiaLib
When I release a new package, you will just have to override the /ManiaLib package in the libraries folder

Re: ManiaLib 2.0

Posted: 06 Jan 2011, 18:02
by gouxim
We are going to update ManiaLib 2.0 to use namespaces, just like ManiaLive does. The idea is that both projects share architecture and some packages so we and the community can share help and documentation on those projects.

I may realase soon a preview package of ManiaLib 2.0 with namespaces, let me know if anyone is interested.

Re: ManiaLib 2.0

Posted: 07 Jan 2011, 16:07
by gouxim
I uploaded a zip package with the latest revision of ManiaLib 2.0. It's a preview package.
It now uses namespaces just like ManiaLive, so PHP 5.3+ is required.

Download: http://code.google.com/p/manialib/downloads/list
API doc: http://api.manialib.com/2.0/

Same warning as before still applies

Re: ManiaLib 2.0

Posted: 07 Jan 2011, 19:07
by reaby
Thanks, if i have time i'll look into standalone manialib2, tho mostly i use it from manialive.
Keep up the good work guys!