namespace App\Models; class User { // class definition } // usage $user = new User(); echo $user::class; // Output: App\Models\User echo get_class($user); // Output: App\Models\User echo $user->getCanonicalName(); // Output: App\Models\User
use Symfony\Component\Console\Input\InputArgument; $argument = new InputArgument('name', InputArgument::REQUIRED, 'Name of the user'); echo $argument->getCanonicalName(); // Output: Symfony\Component\Console\Input\InputArgumentThis example uses the InputArgument class from the Symfony Console component to create an argument object with a required name. The fully-qualified name of the InputArgument class is then printed using the `getCanonicalName()` method. Package/Library: There is no specific package or library associated with the getCanonicalName method as it is built-in PHP functionality.