What is the best way to set up libphonenumber(PHP) manually without Composer?

Viewed 2017

Due to some constraints, I'm unable to install libphonenumber via composer, so I've manually added it to my project's lib directory.
I'm getting the following error when I try to use it via manual setup:
PHP Fatal error: Class 'libphonenumber\CountryCodeToRegionCodeMap' not found in /home/cellulant/CODE/MSISDNVALIDATIONAPI/lib/libphonenumber/src/PhoneNumberUtil.php on line 404

This, despite the fact that CountryCodeToRegionMap.php can be found in libphonenumber/src directory

The libphonenumber directory is in my project's lib directory. The following is my directory structure

├── docs
├── index.php
├── lib
│   └── libphonenumber
│       ├── composer.json
│       ├── docs
│       │    ...
│       ├── LICENSE
│       ├── METADATA-VERSION.txt
│       ├── README.md
│       └── src
│           ...

In my index.php, I have these:

<?php

include "lib/libphonenumber/src/PhoneNumberUtil.php";

$num = "0234567787";

try 
{
    $phoneUtil = \libphonenumber\PhoneNumberUtil::getInstance();

    $numberProto = $phoneUtil->parse($num, "US");
    var_dump($numberProto);
} 
catch (Exception $ex)
{
    echo "Exception: " . $ex->getMessage() . "\n";
}
2 Answers
Related