I am using the php implmentation of libphonenumber from
giggsey/libphonenumber-for-php
I need it to just do a basic sense and validity check on a phone number entered by a users.
I have taken the whole src/libphonenumber
directory and its sub directories and copied it into my project. I do not use Composer and, as this is only one element of my project, am hoping not to have to climb that particular learning curve just now. I put the following simple autoloader at the start of the script.
namespace libphonenumber;
spl_autoload_register('libphonenumber\myAutoloader');
function myAutoloader($className)
{
$path = 'libphonenumber/';
$parts=explode('\\',$className,2);
$filename=str_replace('\\','/',$parts[1]);
include $path.$filename.'.php';
}
The auto loader works fine except for when it comes to include the file geocoding/Locale.php
which includes a single class 'Locale' as follows;
class Locale extends \Locale
The error I get is
PHP Fatal error: Class 'Locale' not found in /var/www/luthor/php/libphonenumber/geocoding/Locale.php on line 6
I am pretty new to namespaces and oo in php. I understand that Locale is a php class. My question is Why is it not found