ManiaLib\Manialink: our (new) PHP lib for building XML

Open source, lightweight PHP framework for Manialink and Web development.

Moderator: NADEO

TheM
Posts: 1446
Joined: 15 Jun 2010, 14:30
Location: Uden, Noord-Brabant, Netherlands
Contact:

Re: ManiaLib\Manialink: our (new) PHP lib for building XML

Post by TheM »

gouxim wrote:Short answer: it is a bit presumptuous from you to say this ;)

Longer answer: I work with manialib on a daily basis, i have written it, and i work with netbeans which provides code hints and completion. So in the end, documenting it will not make coding easier for me. It will just be more things to write and maintain.
Okay, maybe my wording wasn't right (and I didn't meant to be insulting).
Just writing documentation afterwards takes quite some more time then when you do it directly when you're coding it (at least that's my experience). And until now Nadeo projects don't have the reputation to be properly documentated and that's something I find quite a pity :|
Global moderator | Dutch moderator | Laddermoderator | ManiaWiki moderator
Server Manager/webmaster of Smurfen.net, join us on Canyon, Valley and Royal!
ESL (Game) Staff Head for TrackMania (Stadium, Canyon and Valley).
User avatar
gouxim
Nadeo
Nadeo
Posts: 1188
Joined: 14 Jun 2010, 17:20

Re: ManiaLib\Manialink: our (new) PHP lib for building XML

Post by gouxim »

No offence taken. If it was a pure open source project, i would probably document it from the begining. But this is mainly our internal framework , which i open source because i figured some may find it interesting.

It's true that Nadeo has not a very good reputation for documenting things. We are a small team and always have to choose between documentation, features, etc. In this very competitive market, it's always hard to choose to work on documentation.

It's getting better though! For instance we started https://github.com/maniaplanet/documentation a few month back. I agree it's not ideal, but it's a good start imo.
Please do not PM for support. Instead, create a thread so that everyone can contribute or benefit from the answer! 8-)
oliverde8
Posts: 1345
Joined: 16 Jun 2010, 07:33
Location: in a Blue Box

Re: ManiaLib\Manialink: our (new) PHP lib for building XML

Post by oliverde8 »

gouxim wrote:Short answer: it is a bit presumptuous from you to say this ;)

Longer answer: I work with manialib on a daily basis, i have written it, and i work with netbeans which provides code hints and completion. So in the end, documenting it will not make coding easier for me. It will just be more things to write and maintain.
Adding in the documentation the return type to the functions of classes will allow Netbeans to give you better tips, if not very often it can't determine the type of the value returned. Even if you don't write a full documentation writing that would help quite a lot. Then as you don't use getters it isn't something you need to do very often.
And as a big hater of public attributes(even throught I use them a lot), netbeans also generates getter and setters automatically(Quite stupidly it won't try to guess the type of the variables to add the correct documentation so need to write it which is stupid :evil: (maybe a configuration I haven't seen)). But I can understand the coding fast to give priority to features even throught there is something quite good existing so why to rush? :D

Great job anyway and please tell magnetik to realese a version of ManaiLive before he uses the new library XD we will never finish coding our eXtensions if pass our time changing stuff :)
Image
Developper for The next generation, Clean and Powerfull controller eXpansion for your SM & TM server . Working on eXpansion² with full MP4 support and many other awesome features...
User avatar
Jojo_44
Posts: 500
Joined: 12 Jul 2010, 15:58
Location: Germany->Bavaria
Contact:

Re: ManiaLib\Manialink: our (new) PHP lib for building XML

Post by Jojo_44 »

I like the idea of developing it "open source" on github :thumbsup:

Personally I don´t write my manialinks as php Objects, I hava a maniascript/manialink gui which generates xml for me. I only need php(or any other language) to pass some data to the manialink. So what I would like to see in the future is something like this:

Code: Select all

$ml = new Manialink('mls/someManialink.xml');
$quad = $ml->find('id of the quad');
$quad->setPosn($x, $y);
btw do you have any plans to extract the StyleParser from manialib too and make it available through composer ? I think the StyleParser is the most used maniaplanet library out there and it´s a bit overkill to import manialib all the time.

Jojo
Image
my english sounds very unfriendly but it isn´t ;)
User avatar
gouxim
Nadeo
Nadeo
Posts: 1188
Joined: 14 Jun 2010, 17:20

Re: ManiaLib\Manialink: our (new) PHP lib for building XML

Post by gouxim »

Jojo_44 wrote:So what I would like to see in the future is something like this:

Code: Select all

$ml = new Manialink('mls/someManialink.xml');
$quad = $ml->find('id of the quad');
$quad->setPosn($x, $y);
I think it is pretty easy to do in a separate package. You just have to load your XML with DOM, then recursively parse the tree and create associated ManiaLib objects based on tag names. Don't think it'd be fast though, performance-wise.
Jojo_44 wrote: btw do you have any plans to extract the StyleParser from manialib too and make it available through composer ? I think the StyleParser is the most used maniaplanet library out there and it´s a bit overkill to import manialib all the time.
We didn't. But that's a good idea, we will do that :thumbsup:
Please do not PM for support. Instead, create a thread so that everyone can contribute or benefit from the answer! 8-)
User avatar
gouxim
Nadeo
Nadeo
Posts: 1188
Joined: 14 Jun 2010, 17:20

Re: ManiaLib\Manialink: our (new) PHP lib for building XML

Post by gouxim »

Please do not PM for support. Instead, create a thread so that everyone can contribute or benefit from the answer! 8-)
User avatar
gouxim
Nadeo
Nadeo
Posts: 1188
Joined: 14 Jun 2010, 17:20

Re: ManiaLib\Manialink: our (new) PHP lib for building XML

Post by gouxim »

Alignment and Relative Alignment in ManiaLib\Manialink

* Frame Size and Alignment emulates the behaviour of standard elements alignment in frames. With this you can create logical containers with a size, and position them using aligns and relative aligns (see below).

* Relative Alignment helps position an element relative to its parent container. For this, you need a frame with a size and a child with a size ; for instance you can put a quad in the "bottom right corner of a frame with a size".

I created a Gist to help understand these concepts visually.

Demo manialink: manialib-manialink:align
Gist with PHP source: https://gist.github.com/gou1/9970824
Please do not PM for support. Instead, create a thread so that everyone can contribute or benefit from the answer! 8-)
User avatar
gouxim
Nadeo
Nadeo
Posts: 1188
Joined: 14 Jun 2010, 17:20

Re: ManiaLib\Manialink: our (new) PHP lib for building XML

Post by gouxim »

ManiaLib\Manialink split and depends on ManiaLib\XML

* XML-related stuff that had nothing to do with Manialinks is now in ManiaLib\XML at https://github.com/maniaplanet/manialib-xml
* ManiaLib\Manialink now depends on it through composer requirements
* Node::setTagName() is renamed Node::setNodeName() (same for all "$tagName" related stuff).
* Both packages are now tagged v0.1.0 so you can now require "~0.1" in composer, and it should be easier from now on not to break compat...

If you're not using internal stuff you should be fine :)
Please do not PM for support. Instead, create a thread so that everyone can contribute or benefit from the answer! 8-)
User avatar
gouxim
Nadeo
Nadeo
Posts: 1188
Joined: 14 Jun 2010, 17:20

Re: ManiaLib\Manialink: our (new) PHP lib for building XML

Post by gouxim »

I created a 0.1 branch and release on both projects, so that people using current version can still work with it.
"master" branch now is going to break compatibility, and will eventually become the 1.x branch.
Please do not PM for support. Instead, create a thread so that everyone can contribute or benefit from the answer! 8-)
User avatar
gouxim
Nadeo
Nadeo
Posts: 1188
Joined: 14 Jun 2010, 17:20

Re: ManiaLib\Manialink: our (new) PHP lib for building XML

Post by gouxim »

We're using Symfony EventDispatcher and updating manialib-xml (and therefore manialib-manialink) to use it. As said above, it breaks compat with v0.x.

Branches for that feature:
https://github.com/maniaplanet/manialib ... dispatcher
https://github.com/maniaplanet/manialib ... dispatcher

They will be merged in master eventually.
Please do not PM for support. Instead, create a thread so that everyone can contribute or benefit from the answer! 8-)
Post Reply

Return to “ManiaLib”

Who is online

Users browsing this forum: No registered users and 0 guests