src/Phone_number.php
public function get_carrier_name_for_number($phone_number = '', $region = NULL, $mode = NULL)
    {
        $inputParams = array(
            'phone_number' => $phone_number,
            'region'       => $region,
            'mode'         => $mode
        );
        $this->debug->info(__FUNCTION__, 'Input Params: ', $inputParams);
        if (empty($phone_number)) {
            $this->debug->warning(__FUNCTION__, 'Phone Number input is Empty!');

            return NULL;
        }
        $phone_number = trim($phone_number);
        try {
            $phoneNumberUtil   = PhoneNumberUtil::getInstance();
            $use_region        = NULL !== $region ? strtoupper($region) : self::DEFAULT_REGION;
            $phoneNumberObject = $phoneNumberUtil->parse(trim($phone_number), $use_region);
            $carrierMapper     = PhoneNumberToCarrierMapper::getInstance();
            if (strtolower($mode) == 'safe') {
                $result = $carrierMapper->getSafeDisplayName($phoneNumberObject, self::DEFAULT_LANGUAGE);
            } elseif (strtolower($mode) == 'valid') {
                $result = $carrierMapper->getNameForValidNumber($phoneNumberObject, self::DEFAULT_LANGUAGE);
            } else {
                $result = $carrierMapper->getNameForNumber($phoneNumberObject, self::DEFAULT_LANGUAGE);
            }
            $this->debug->debug(__FUNCTION__, 'Use REGION: ' . $use_region);
            $this->debug->info(__FUNCTION__, 'Final Result: ', $result);

            return $result;
        }
        catch (\Exception $e) {
            $message = 'Error File: ' . $e->getFile() . ' - Line: ' . $e->getLine() . ' - Code: ' . $e->getCode() . ' - Message: ' . $e->getMessage();
            $this->debug->error(__FUNCTION__, $message);

            return NULL;
        }
    }
public function get_carrier_name_for_number($phone_number = '', $region = NULL, $mode = NULL)
    {
        $inputParams = array(
            'phone_number' => $phone_number,
            'region'       => $region,
            'mode'         => $mode
        );
        $this->debug->info(__FUNCTION__, 'Input Params: ', $inputParams);
        if (empty($phone_number)) {
            $this->debug->warning(__FUNCTION__, 'Phone Number input is Empty!');

            return NULL;
        }
        $phone_number = trim($phone_number);
        try {
            $phoneNumberUtil   = PhoneNumberUtil::getInstance();
            $use_region        = NULL !== $region ? strtoupper($region) : self::DEFAULT_REGION;
            $phoneNumberObject = $phoneNumberUtil->parse(trim($phone_number), $use_region);
            $carrierMapper     = PhoneNumberToCarrierMapper::getInstance();
            if (strtolower($mode) == 'safe') {
                $result = $carrierMapper->getSafeDisplayName($phoneNumberObject, self::DEFAULT_LANGUAGE);
            } elseif (strtolower($mode) == 'valid') {
                $result = $carrierMapper->getNameForValidNumber($phoneNumberObject, self::DEFAULT_LANGUAGE);
            } else {
                $result = $carrierMapper->getNameForNumber($phoneNumberObject, self::DEFAULT_LANGUAGE);
            }
            $this->debug->debug(__FUNCTION__, 'Use REGION: ' . $use_region);
            $this->debug->info(__FUNCTION__, 'Final Result: ', $result);

            return $result;
        }
        catch (\Exception $e) {
            $message = 'Error File: ' . $e->getFile() . ' - Line: ' . $e->getLine() . ' - Code: ' . $e->getCode() . ' - Message: ' . $e->getMessage();
            $this->debug->error(__FUNCTION__, $message);

            return NULL;
        }
    }
Function get_carrier_name_for_number

Returns the name of the carrier for the supplied PhoneNumber object within the $language supplied.

Returns the same as getNameForNumber() without checking whether it is a valid number for carrier mapping.

Returns the same as getNameForNumber(), but only if the number is safe for carrier mapping.
A number is only validate for carrier mapping if it's a Mobile or Fixed line,
and the country does not support Mobile Number Portability.

@author: 713uk13m <dev@nguyenanhung.com>
@time  : 9/21/18 01:57

@param string $phone_number Phone Number to get Carrier Name
@param string $region       Region, example VN
@param string $mode         Mode String: safe, valid, other...

@see   https://github.com/nguyenanhung/vn-telco-phonenumber/blob/master/test_phone_number.php
@see   https://github.com/giggsey/libphonenumber-for-php/blob/master/docs/PhoneNumberUtil.md

@return mixed|null|string String if Success, Null if Not