nobrandheroes
nobrandheroes

Reputation: 758

Using Composer Autoloader with PSR-4

I'm looking at examples, and I cannot get my code to work.

Directory Structure

app
    src
        company
            FileExport
                FileExport.php
                FileExportInterface.php
            Validator
    vendor
        ...

My composer.json

"require": {
    "monolog/monolog": "1.9.1",
    "ilya/belt": "2.1.1"
},
"autoload": {
    "psr-4": {"Company\\": "src"}
}

Namespace is Company\FileExport.

Classes in vendor work fine, but not mine. I've run composer update as well.

Upvotes: 0

Views: 120

Answers (1)

cmorrissey
cmorrissey

Reputation: 8593

Your autoload should look like so

   "autoload": {
        "psr-4": {"Company\\": "src/company/"}
    }

Upvotes: 1

Related Questions