0

I have created a composer library.

I have one folder:

Models

Inside that is 1 file, it has a namespace declared TestJames

In my composer.json file I have:

"autoload": {
    "psr-0": { "TestJames": "Models/" }
} 

Firstly, I have no idea what the psr-0 bit means. Secondly, I am unsure of the order of bits and bobs.

Is there a documentation specifically for this part, and what am I doing wrong?

Jimmyt1988
  • 20,466
  • 41
  • 133
  • 233

1 Answers1

0

PSR-0 is a standard for autoloading, but it's deprecated (if you can, use PSR-4). See more in here.

For doc about composer autoload look here

It seems to be better:
"autoload": {
    "psr-0": { "TestJames\\": "Models/" }
}

Has you executed "composer update"? It creates your vendor directory and you autoload.php file.

Also important is that you require vendor/autoload.php in your execution flow before you try to acces to this class.

Jordi Martínez
  • 358
  • 3
  • 14
  • That worked, thank you! I also had to uninstall the previous version as it could no longer see the files of the old type I tried... Thanks – Jimmyt1988 Nov 13 '14 at 10:50