How to use another Namespace required by PHP extension?
Hello I'd like to use a PHP extension called Gender: https://www.php.net/manual/en/book.gender.php
but it required a Custom namespace
namespace Gender;
So I can't use it because of Laravel controller namespace
namespace App\Http\Controllers
So what is the best solution ?
You can import stuff from any namespace. Just ignore the example in the docs
use Gender\Gender;
//inside your controller method
$name = "Milene";
$country = Gender::FRANCE;
$result = $gender->get($name, $country);
$data = $gender->country($country);
Thanks For Reply ♥
It's Work
Please or to participate in this conversation.