yodarunamok / fxphp

FX.php -- The best way from FileMaker to the Web
http://fx.iviking.org/
44 stars 29 forks source link

Consider adding composer.json #39

Open matatirosolutions opened 6 years ago

matatirosolutions commented 6 years ago

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

TyrfingMjolnir commented 6 years ago

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": "chris@iviking.org",
            "homepage": "http://www.iviking.org"
        },
        {
            "name": "Gjermund Gusland Thorsen",
            "email": "gjermundprivat@gmail.com"
        },
        {
            "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": {
    }
}
matatirosolutions commented 6 years ago

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

TyrfingMjolnir commented 6 years ago

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

matatirosolutions commented 6 years ago

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'...

TyrfingMjolnir commented 6 years ago

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

TyrfingMjolnir commented 6 years ago

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