1

I've made a little library for myself and I'm trying to autoload it into my laravel project, it installs fine but whenever I try to use the class it simply says it's not found.

I've checked all the classmap files in vendor/composer and it doesn't seem to be in any of them.

This is my composer.json for my lib:

{
    "name": "my-user/aspect-parser",
    "version": "1.0.0",
    "type": "package",
    "require": {
        "nesbot/carbon": "^1.22"
    },
    "autoload": {
      "psr-4": {
        "AspectParser\\": "src/"
      }
    }
}

My file structure is:

  • AspectParser
    • src
      • Parser.php
Nathan
  • 534
  • 1
  • 5
  • 13
  • how do you try to instantiate your object? and what the full error exception – hassan Apr 01 '17 at 11:08
  • I think the issue was the `type`, I've changed it to library and it adds it to the autoload files. Now I'm just having trouble trying to import it with `use` (error is Class not found). `PHP Fatal error: Class 'AspectParser\Parser' not found in eval()'d code on line 1` – Nathan Apr 01 '17 at 11:15

1 Answers1

0

It was an issue with the type in composer.json. I've changed it to library and it adds to the autoload classmap.

Nathan
  • 534
  • 1
  • 5
  • 13