Page 1 of 1

[Request] Make MPWS-SDK ready for Composer

Posted: 01 Dec 2013, 11:30
by m4rcel
Today I have a little request for the MPWS repository: Please make it ready to be used with Composer.

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/"
        }
    }
}
I am not sure about the developers actually involved in the MPWS-SDK, so you may want to change that part of the json file.

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 ;) And if you made the MPWS SDK ready for composer, please continue with the TMWS SDK, ManiaLib and all your other projects :D

Re: [Request] Make MPWS-SDK ready for Composer

Posted: 01 Dec 2013, 12:20
by Jojo_44
+1

A lot of big php projects/frameworks are already using composer + packagist so it´s kinda standard. Btw github supports packagist so you can create a hook that everytime you push to github, packagist gets automatically updated.

regards, Jojo

Re: [Request] Make MPWS-SDK ready for Composer

Posted: 01 Dec 2013, 13:05
by oliverde8
This would be great, :thumbsup:
After getting used to it it is just fantastic how easy things can get when using composer.

Re: [Request] Make MPWS-SDK ready for Composer

Posted: 10 Jan 2014, 14:42
by magnetik

Re: [Request] Make MPWS-SDK ready for Composer

Posted: 10 Jan 2014, 17:19
by Jojo_44
Good job :thx: