I am using a library that I downloaded with composer called Pheanstalk. I am running the following script:
<?php
//... some unrelated code
require_once('vendor/autoload.php'); //loading the autoload file from composer
use Pheanstalk\Pheanstalk; //using the namespace
$pheanstalk = new Pheanstalk('127.0.0.1'); //initiating an object
//... some unrelated code
?>
The following error appears:
Fatal Error: Class 'Pheanstalk\Pheanstalk' not found in /opt/lampp/htdocs/project_zero/index.php on line 16
with line 16 being: $pheanstalk = new Pheanstalk('127.0.0.1');
Question: Why might I be getting this error? The script above was basically copy-paisted from the Usage Example given on the Pheanstalk github page: https://github.com/pda/pheanstalk.
The contents of my composer.json
file are:
{
"require": {
"pda/pheanstalk": "2.1.1"
}
}
EDITED:
New errors when using:
use \Pheanstalk_Pheanstalk
Errors:
Warning: The use statement with non-compound name 'Pheanstalk_Pheanstalk' has no effect in /opt/lampp/htdocs/project_zero/index.php on line 14
Fatal error: Class 'Pheanstalk' not found in /opt/lampp/htdocs/project_zero/index.php on line 17