I have two classes in the same folder in own files. But when I am trying to extends one to another it is giving namespace and class not found error.
Info: It is the first time I am extending class using namespace. Also nested namespace is new to me.
DB\CRUD
So may be I am doing completely wrong with namespace.
Error message:
Fatal error: Class 'DB\AT_Database' not found in /var/www/...
DB class
File: AT_Database.php
namespace DB;
class AT_Database
{
...
}
CRUD class
File: AT_CRUD.php
namespace DB\CRUD;
use DB\AT_Database;
class AT_CRUD extends AT_Database
{
public function __construct()
{
}
}
include
ing or autoloading the AT_Database.php file?( glob( $this->classes_dir . "/*.php" )
I have added error message in question. Please have a look. Also if you thin__autoload
would work better than I may use that.AT_Database
intoAT_CRUD
. There are many dependency injection containers out there. Pimple for example is a very lightweight one.