Composer is a very nice tool to resolve the dependencies of a project. You write down the packages you need (and the version, if you need a specific one), and the tool will automatically download and save all the files to your project. Additionally, an autoload.php file is generated to include all downloaded packages, so no need to e.g. load the MPWS-autoloader and TMWS-autoloader separately.
To make the repository ready for composer, only two steps are needed:
1. Add a composer.json to the root of your trunk:
The composer.json may look like the following:
Code: Select all
{
"name": "nadeo/maniaplanet-ws-sdk",
"description": "The Maniaplanet Web Services is the public API that everyone can use to retrieve various information about the game, the players, the rankings, etc. You can use that API to build all sorts of applications. ",
"type": "library",
"keywords": ["nadeo", "webservices", "sdk", "php"],
"license": "LGPL-3.0",
"authors": [
{
"name": "magnetik",
"email": "magnetik@nadeo.com",
"homepage": "http://www.maniaplanet.com/",
"role": "Developer"
},
{
"name": "gouxim",
"email": "gouxim@nadeo.com",
"homepage": "http://www.maniaplanet.com/",
"role": "Developer"
}
],
"require": {
"php": ">=5.3.0"
},
"autoload": {
"psr-0": {
"Maniaplanet\\": "libraries/"
}
}
}
As said, simply commit this file to your /trunk directory.
2. Add the package to Packagist:
After comitting the composer.json to the trunk, go to the website https://packagist.org/ (create an account if not already done) and submit the MPWS-SDK as a new package to this site. Packagist should automatically detect the versions of the SDK based on the tags.
There is already a copy of the MPWS-SDK registered in Packagist, but I would like to see the official repository in there

