I installed composer and initiate in my project folder. so after installed that /vendor folder created in my project directory by composer.
after that i created two file 1.abc.php 2.demo.php
in abc.php my code is:
namespace abc;
class abc
{
public function pm()
{
echo "test";
}
}
and my demo.php file code is :
<?php
require_once __DIR__.'/vendor/autoload.php';
use abc\abc;
$abc = new abc();
I just want to access pm() method of 'abc' class using 'namespace' and 'use' method without using this require_once 'abc.php'.
But i getting below error while call demo.php.
Fatal error: Uncaught Error: Class 'abc\abc' not found in /opt/lampp/htdocs/mycomposer/demo.php:8
My File path : opt/lampp/htdocs/php/mycomposer/demo.php
opt/lampp/htdocs/php/mycomposer/abc.php
opt/lampp/htdocs/php/mycomposer/vendor
Any idea please share. Thanks