Problem:
I have the following file structure
-api (contains index.php)
--src
---vendor
----auth (contains auth.php)
----bin
----composer
----nesbot
----rbdwllr
----sympfony
here is my composer.json
{
"autoload": {
"psr-4": {
"AuthSpace\\": "/auth",
"Tests\\": "/rbdwllr/reallysimplejwt/tests",
"Symfony\\Polyfill\\Mbstring\\": "/symfony/polyfill-mbstring",
"Symfony\\Component\\Translation\\": "/symfony/translation",
"ReallySimpleJWT\\Helper\\": "/rbdwllr/reallysimplejwt/src/Helper",
"ReallySimpleJWT\\Exception\\": "/rbdwllr/reallysimplejwt/src/Exception",
"ReallySimpleJWT\\": "/rbdwllr/reallysimplejwt/src",
"": "/nesbot/carbon/src"
}
}
}
index.php
require __DIR__ . '/src/vendor/autoload.php';
$argument1 = $_GET['argument1'];
$tokenCode = $_GET['tokenCode'];
include 'config/database.php';
include 'objects/program1.php';
include 'auth.php';
use ReallySimpleJWT\Token;
use Carbon\Carbon;
$secret = "somesecret";
if (($_SERVER['REQUEST_METHOD']) == "GET") {
if ($_GET['url'] == "bankquery") {
if($tokenCode===NULL){
echo "no correct token provided";
print($results);
} else {
$results = Token::validate($tokenCode, $secret);
if ($results = 1){
$var = new AuthClass();
$var = AuthClass::checkTime($tokenCode);
} else {
echo "no correct token provided";
}
}
} else {
echo "some GET other query";
}
?>
auth.php
<?php namespace AuthSpace;
use ReallySimpleJWT\Token;
use Carbon\Carbon;
class AuthClass{
public static function checkTime($tokenCode){
// getting payload from token code by accessing the composer dependency method in a class Token
$received = Token::getPayload($tokenCode);
return $received;
}}
?>
I've generated the autoload using composer dump-autoload
, checked the prs4 links - they all seem to show correct directory and namespace linking.
But nontheless, after running index.php file i keep getting the following error, but don't know why.
PHP Fatal error: Uncaught Error: Class 'AuthSpace\AuthClass' not found