0

I'm attempting to use a class from a repository I installed from packagist with composer. The PHP file I'm writing is under my Project folder, along with the repository which is in Project>vendor.

include "Project/vendor/autoload.php";
include "Project/vendor/smartcat/smartcat-api/src/SmartCAT/API/SmartCAT.php";


use SmartCAT\API\SmartCAT;
use SmartCAT\API\Model\CreateProjectWithFilesModel;

This is at the top of my file and it is how I'm retrieving the smartcat class from the repository. When I try to use the class I wrote $sc= new SmartCAT($login, $password);. This causes the error: PHP Fatal error: Uncaught Error: Class 'SmartCAT\API\SmartCAT' not found in C:\Users\...\Project\createProject.php:20. When I run get_included_files() the necessary files are included. I'm not sure why I'm unable to use the class.

atlas cube
  • 47
  • 1
  • 1
  • 6

1 Answers1

0

Did you try using the vendor/autoload.php path in the include directive?

If your createProject.php file and vendor folders are located in the same folder, you need to use include "vendor/autoload.php";

Edi Modrić
  • 2,240
  • 1
  • 15
  • 18