Skip to content

Composer autoload broken #24

@RSully

Description

@RSully

I'm new to composer so forgive me if I'm just using it incorrectly.

I added your project to my composer.json like so:

{
    "require": {
        "jlogsdon/cli": "0.9.*"
    }
}

However I got errors like this:

PHP Fatal error:  Call to undefined function cli\line() in ~/dev/myproject/vendor/jlogsdon/cli/lib/cli/Table.php on line 115

The solution was for me to modify my composer.json to add cli.php:

{
    "require": {
        "jlogsdon/cli": "0.9.*"
    },
    "autoload": {
        "files": ["vendor/jlogsdon/cli/lib/cli/cli.php"]
    }
}

Since there aren't any classes in that file (and your composer.json is set to psr-0) I don't think it is finding the functions correctly.

I think the fix to this could be as simple as modifying your composer.json to look something like this:

{
    "autoload": {
        "psr-0": {"cli": "lib/"},
        "files": ["lib/cli/cli.php"]
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions