PHPackages                             ahmedghanem00/tempnumber-api-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. ahmedghanem00/tempnumber-api-client

ActiveLibrary[API Development](/categories/api)

ahmedghanem00/tempnumber-api-client
===================================

An API client for Temp-Number service ( https://temp-number.org/ )

1.1.10(2y ago)5351MITPHPPHP ^8.2

Since Apr 28Pushed 2y ago1 watchersCompare

[ Source](https://github.com/ahmedghanem00/tempnumber-api-client)[ Packagist](https://packagist.org/packages/ahmedghanem00/tempnumber-api-client)[ RSS](/packages/ahmedghanem00-tempnumber-api-client/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (5)Versions (6)Used By (0)

TempNumber Api Client
=====================

[](#tempnumber-api-client)

An API client for Temp-Number service (  ) written in PHP.

If you encounter a bug or have an idea to improve the code, feel free to open an issue or submit a pull request.

Installation
------------

[](#installation)

```
$ composer require ahmedghanem00/tempnumber-api-client

```

Usage
-----

[](#usage)

#### Client Initialization :

[](#client-initialization-)

```
use ahmedghanem00\TempNumberClient\Client;

$client = new Client('YOUR_API_TOKEN');
```

#### Retrieve Balance :

[](#retrieve-balance-)

```
try {
    echo $client->retrieveBalance(); // float "3.15"
} catch (Exception $e) {
    echo $e->getMessage();
}
```

#### Requesting new activation :

[](#requesting-new-activation-)

```
use ahmedghanem00\TempNumberClient\Enum\Country;
use ahmedghanem00\TempNumberClient\Enum\Service;

try {
    # You can either use Service & Country enums as arguments or use the ids directly ( 'facebook', 'us' )
    # If the activation price is higher than the given expected, the 'ExpectedPriceException' will be thrown
    $newActivation = $client->requestNewActivation(Service::Facebook, Country::United_States, $expectedPrice = 2.5);

    [$countryCode, $numberOnly, $formattedPhoneNumberWithCountryCode] = [
        $newActivation->getPhoneNumberCountryCode(),
        $newActivation->getPhoneNumberWithoutCountryCode(),
        $newActivation->getFormattedPhoneNumberWithCountryCode()
    ];

    # Will continuously polling the activation data from server until the specified condition is met.
    # Otherwise, the appropriate exception will be thrown
    $fulfilledActivationWithSmsMessage = $client->waitForActivationStatus($newActivation->getId(), ActivationStatus::SMS_RECEIVED, $pollingInterval = 2, $maxDuration = 100);

    echo $fulfilledActivationWithSmsMessage->getReceivedSMS(); ## "Thanks for activation. Your activation code is: 5678"
    echo $fulfilledActivationWithSmsMessage->getDetectedOtpCodeFromReceivedSMS(); ## "5678"
} catch (Exception $e) {
    echo $e->getMessage();
}
```

#### Retry Activation :

[](#retry-activation-)

In case you have specific activation that needs to be retried

```
try {
    $client->retryActivation(181822);
} catch (Exception $e) {
    echo $e->getMessage();
}
```

#### Retrieve specific activation data :

[](#retrieve-specific-activation-data-)

```
try {
    $activationData = $client->retrieveActivationData(181822);

    echo $activationData->getStatus(); // string "smsRequested"
    echo $activationData->getCreationTimestamp(); // int "1681333257"
    echo $activationData->getRemainingSecondsToExpire(); // int "300"
    echo $activationData->isRetryable(); // bool "false"
    echo $activationData->getPhoneNumberWithoutCountryCode(); // string "(555) 555-1234"
catch (Exception $e) {
    echo $e->getMessage();
}
```

#### Retrieve specific Service &amp; country Info :

[](#retrieve-specific-service--country-info-)

```
use ahmedghanem00\TempNumberClient\Enum\Country;
use ahmedghanem00\TempNumberClient\Enum\Service;

try {
    $info = $client->retrieveCountryServiceInfo(Service::Instagram, Country::Russia)

    echo $info->hasNumbers(); // bool "true"
    echo $info->getPrice(); // float "2.15"
} catch (Exception $e) {
    echo $e->getMessage();
}
```

#### Retrieve all services/countries info :

[](#retrieve-all-servicescountries-info-)

```
# Grouped by service
$infoGroupedByService = $client->retrievePriceListByService();

# OR by country
$infoGroupedByCountry = $client->retrievePriceListByCountry();

foreach ($infoGroupedByCountry as $country) {
    echo $country->getName(); // 'uk'

    foreach ($country->services() as $countryService) {
        echo $countryService->getName(); // string "facebook"
        echo $countryService->getPrice(); // float "1.25"
    }
}
```

#### Retrieve all previous activations data :

[](#retrieve-all-previous-activations-data-)

```
$result = $client->retrieveActivationHistory($page = 2, $limit = 5);

echo $result->getPageIndex(); // 2
echo $result->getPagesCount(); // 30
echo $result->getActivationsCount(); // 200

foreach ($result->activations() as $activation) {
    echo $activation->getId();
    echo $activation->getStatus();
    echo $activation->getPrice();
    echo $activation->getFormattedPhoneNumberWithCountryCode();
    echo $activation->getReceivedSMS();
}
```

LICENSE
-------

[](#license)

Package is licensed under the [MIT License](http://opensource.org/licenses/MIT).

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~128 days

Total

4

Last Release

776d ago

PHP version history (2 changes)1.0.0PHP &gt;=8.2

1.1.10PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/124502255?v=4)[Ahmed Ghanem](/maintainers/ahmedghanem00)[@ahmedghanem00](https://github.com/ahmedghanem00)

---

Top Contributors

[![ahmedghanem00](https://avatars.githubusercontent.com/u/124502255?v=4)](https://github.com/ahmedghanem00 "ahmedghanem00 (28 commits)")

---

Tags

api-clientapi-client-phpdisposable-phone-numberphptemporary-phone-numberapi clienttemporary phone numberdisposable phone number

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ahmedghanem00-tempnumber-api-client/health.svg)

```
[![Health](https://phpackages.com/badges/ahmedghanem00-tempnumber-api-client/health.svg)](https://phpackages.com/packages/ahmedghanem00-tempnumber-api-client)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M738](/packages/sylius-sylius)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M203](/packages/sulu-sulu)[oro/platform

Business Application Platform (BAP)

645143.5k115](/packages/oro-platform)[contao/core-bundle

Contao Open Source CMS

1231.6M2.8k](/packages/contao-core-bundle)[storyblok/php-management-api-client

Storyblok PHP Client for Management API

1233.5k3](/packages/storyblok-php-management-api-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
