bytes4sale/phone-number-info
Laravel package for validating phone numbers and querying hlrlookup.com for HLR insights: number type, real-time status, original network, porting info, SMS/MMS email addresses, plus request parameters and credit usage tracking.
Phone-Number-Info is a Laravel package that provides useful information related to phone numbers, including Home Location Register (HLR) insights, number types, original network details, and more.
The Phone-Number-Info Laravel package comes with the following features:
Phone Number Validation:
HLR Lookups:
Number Type Detection:
Original Network Details:
Number Porting Detection:
SMS and MMS Email Addresses:
Credits Management:
Request Parameters:
Before using the Phone-Number-Info Laravel package, you must fulfill the following prerequisites:
API Key and API Secret from hlrlookup.com:
PHP 7.4 or higher:
Laravel 8.0 or higher:
You can install the package via Composer. Run the following command in your terminal:
composer require bytes4sale/phone-number-info
Before using this package, you need to set your API key and API Secret in the .env file of your Laravel project.
.env file and add:API_KEY=your_hlrlookup_api_key_here
API_SECRET=your_hlrlookup_api_secret_here,
Getting information for a Phone Number is a breeze with phone-number-info. Simply follow these steps:
Initialize phone-number-info: Before using the package, make sure to initialize it. You can do this by adding the ServiceProvider to the config/app.php file:
// config/app.php
'providers' => [
// Other providers...
Bytes4sale\PhoneNumberInfo\PhoneNumberInfoServiceProvider::class,
],
Retrieve Number Information: Once the package is initialized, you can easily get the details for a Phone Number:
use Bytes4sale\PhoneNumberInfo\Facades\PhoneNumberInfo;
// Get information for a single phone number
$phoneNumber = '921234567874';
$response = PhoneNumberInfo::getHlrDetails($phoneNumber);
if ($response->isSuccessful()) {
print_r($response->getContent());
} else{
print_r($response->getErrorResponse());
}
// Get information for multiple phone numbers
$multiplePhoneNumbers = '921234567874,921234567891';
$multipleResponse = PhoneNumberInfo::getHlrDetails($multiplePhoneNumbers);
if ($multipleResponse->isSuccessful()) {
print_r($multipleResponse->getContent());
} else {
print_r($multipleResponse->getErrorResponse());
}
phone-number-info allows you to customize its behavior by publishing its configuration file. To do this, run the following artisan command:
php artisan vendor:publish --tag="number-info-config"
After running the command, you will find the configuration file at config/phonenumberinfo.php. You can modify the settings as per your needs.
| Method | Description |
|---|---|
getNumberError($numbersErrors) |
Get the error messages related to phone numbers. |
getUuid($uuIds) |
Get the UUIDs associated with the phone numbers. |
getRequestParameters($requestParameters) |
Get the parameters used in the request for phone number information. |
getCreditsSpent($numberSpendCredits) |
Get the number of credits spent for retrieving phone number information. |
getFormattedTelephoneNumber($formattedTelephoneNumbers) |
Get the phone numbers in a formatted representation. |
getIsOriginalNetworkAvailable($isOriginalNetworkAvailable) |
Check if the information about the original network is available. |
getOriginalNetworkDetails($originalNetworkDetails) |
Get details about the original network of the phone number. |
getNumberType($numberTypes) |
Get the type of the phone number (e.g., mobile, landline). |
getIsLiveStatusAvailable($isLiveStatusAvailable) |
Check if the live status information is available. |
getIsCurrentNetworkAvailable($isCurrentNetworkAvailable) |
Check if the current network information is available. |
getCurrentNetworkDetails($currentNetworkDetails) |
Get details about the current network of the phone number. |
getIsNumberPorted($isNumberPorted) |
Check if the phone number is ported (i.e., transferred between carriers). |
getSmsEmail($smsEmail) |
Get the SMS email address associated with the phone number. |
getMmsEmail($mmsEmail) |
Get the MMS email address associated with the phone number. |
We welcome contributions from the community to improve bytes4sale phone-number-info. If you find a bug or have a suggestion for a new feature, we encourage you to participate and help make this package even better.
If you encounter any issues or bugs while using bytes4sale phone-number-info, please open an issue in our GitHub repository. When reporting a bug, please provide as much detail as possible, including:
If you have a new feature idea or enhancement in mind, you can also open an issue in the GitHub repository. Please outline the feature's functionality and the problem it solves or the value it adds to the package.
We appreciate contributions from the community to help us improve the package. If you'd like to contribute code, please follow these steps:
master branch.Our team will review your PR, and if everything looks good, we'll merge it into the master branch.
By contributing to bytes4sale phone-number-info, you agree to make your contributions available under this package.
We appreciate the efforts of our contributors, and your help will make the package better for everyone. Thank you!
The MIT License (MIT). Please see License File for more information.
If you find this package helpful, consider giving credit to the authors and contributors.
How can I help you explore Laravel packages today?