Forum


Replies: 3   Views: 1578
Ns version, private respository: class not found errors
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by Mikevg  · 20-04-2021 - 17:49

I've followed the instructions for creating a private repository for the PhpDocx Namespaced version, and integrated it with my lumen framework project, and it is being correctly loaded into the /vendor/<companyname>/phpdocx folder, however when I try to run my code I get a "Class 'phpdocx\Create\CreateDocx' not found" error.

I assume this has something to do with the namespacing / autoloading not setup correctly? I've tried just about everything I can think of as far as the autoload setting goes.

Currently I have this in the PhpDocx repositories composer.json:

"autoload": {
  "psr-4": {
    "phpdocx\\": "phpdocx/Classes/Phpdocx"
  }
},

I've also tried:

"autoload": {
  "psr-4": {
    "phpdocx\\": "<companyname>/phpdocx/Classes/Phpdocx"
  }
},

and both variations without the /Phpdocx at the end, but none of them work. My IDE has no problem resolving these class names, it's just at runtime that it fails.

What do I need to do to get this working?

Thanks.