Joined June 2018
·

aanchalkaura

Magento eCommerce Developer at Seasia Infotech
·
Mohali, India
·
·

Posted to PHP get class name without namespace over 1 year ago

You can do this with reflection.

$reflect = new ReflectionClass($object);
if ($reflect->getShortName() === 'Name') {
// do this
}

You can use ReflectionClass::getShortName which get name of the class without its namespace.

I think this method only works if the base laravel folder is the webroot. I tried , but it didn't instead this I keep getting a 404 error from Laravel.

Achievements
1 Karma
0 Total ProTip Views