Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider adding composer.json #39

Open
matatirosolutions opened this issue Oct 27, 2017 · 6 comments
Open

Consider adding composer.json #39

matatirosolutions opened this issue Oct 27, 2017 · 6 comments

Comments

@matatirosolutions
Copy link

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

@TyrfingMjolnir
Copy link
Collaborator

TyrfingMjolnir commented Oct 27, 2017

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": {
    }
}

@matatirosolutions
Copy link
Author

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
Copy link
Collaborator

TyrfingMjolnir commented Oct 27, 2017

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

@matatirosolutions
Copy link
Author

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
Copy link
Collaborator

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

@TyrfingMjolnir
Copy link
Collaborator

TyrfingMjolnir commented May 31, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant