fxphp icon indicating copy to clipboard operation
fxphp copied to clipboard

Consider adding composer.json

Open matatirosolutions opened this issue 8 years ago • 6 comments

Most modern PHP applications are built using composer. Without a composer.json file this isn't possible.

matatirosolutions avatar Oct 27 '17 05:10 matatirosolutions

You mean a file like this?

{
    "name": "yodarunamok/fxphp",
    "description": "FX.php is a FMPXMLRESULT parser class for php",
    "keywords": ["FX.php", "FMPXMLRESULT", "FileMaker", "CWP", "FileMaker CWP"],
    "homepage": "https://github.com/yodarunamok/fxphp",
    "type": "library",
    "license": "Artistic-2.0",
    "authors": [
        {
            "name": "Chris Hansen",
            "email": "[email protected]",
            "homepage": "http://www.iviking.org"
        },
        {
            "name": "Gjermund Gusland Thorsen",
            "email": "[email protected]"
        },
        {
            "name": "Chris Adams"
        },
        {
            "name": "Masayuki Nii"
        }
    ],
    "support": {
        "issues": "https://github.com/yodarunamok/fxphp/issues"
    },
    "require": {
        "php": "^5.3.2 || ^7.0"
    },
    "require-dev": {
    },
    "config": {
        "platform": {
            "php": "5.3.9"
        }
    },
    "suggest": {
    },
    "autoload": {
      "classmap": ["FX.php"]
    },
    "autoload-dev": {
    },
    "extra": {
        "branch-alias": {
        }
    },
    "scripts": {
    }
}

TyrfingMjolnir avatar Oct 27 '17 05:10 TyrfingMjolnir

Yes - that's exactly what I meant (and more complete than the PR I just submitted).

Please also need to add

    "autoload": {
        "classmap": ["FX.php"]
    },

so that use \FX will load the main class through autoloading

matatirosolutions avatar Oct 27 '17 05:10 matatirosolutions

Are there package manager options to composer for php? So far I have found: PEAR, PECL, and Composer.

TyrfingMjolnir avatar Oct 27 '17 06:10 TyrfingMjolnir

In a lot of PHP projects dependencies are managed using composer. From the perspective of the person trying to use those dependencies it's easiest if they are in packagist because then in order to use the dependency all one needs to do is

    composer require developer/package-name

at which point the most recent stable version (tag from github) is downloaded into your project and the project autoload config updated to allow autoloading of the new package.

Packagist provides the 'glue' between composer and githib. It's possible to use packages which aren't in packagist with composer (so long as they have a composer.json file) but it means that you have to add additional data for each project that you want to use the package in.

As to PEAR and PECL I would suggest that they may have 'had their day'...

matatirosolutions avatar Oct 27 '17 06:10 matatirosolutions

I use spm in swift and npm in NodeJS and this looks quite similar.

TyrfingMjolnir avatar Oct 27 '17 12:10 TyrfingMjolnir

It's added to the repo, can you test this, and see if it works as expected? If not please report the error.

TyrfingMjolnir avatar May 31 '18 17:05 TyrfingMjolnir