Download the PHP package kkxdev/laravel-truecaller-oauth without Composer

On this page you can find all versions of the php package kkxdev/laravel-truecaller-oauth. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-truecaller-oauth

laravel-truecaller-oauth

Server-side Truecaller OAuth 2.0 (SDK 3.x) login for Laravel 8–12.

An app obtains an authorization code from the Truecaller SDK; this package exchanges it for a verified identity. What you do with that identity — find a user, create one, issue a session — stays in your application.

Install

Auto-discovery registers the provider and the Truecaller facade. Set the partner key from the Truecaller developer portal:

To pin the ISO → dial-code map in your own repo:

What it guarantees

A code can be spent once. CacheReplayGuard claims the authorization code atomically before the exchange. A claim is only given back when the spend provably did not happen — a timeout or a provider outage — so a transport blip never burns a code the user could still redeem, while a code Truecaller has already rejected stays dead.

A number is normalised or refused, never guessed. Truecaller returns an ISO alpha-2 country and an E.164-ish number; most user stores want a bare dial code plus a bare national number. PhoneNormaliser tries the plausible readings in order and returns the first that satisfies the configured rule for its dial code, repairing the two malformations that actually occur (a doubled country code, a leading trunk zero). If nothing validates it throws, because a guessed dial code writes a number the real owner can never match — which silently gives them a second account.

Secrets never reach the log. SecretMasker redacts recursively and case-insensitively. Authorization codes are logged as a 12-character fingerprint so one login can be followed across log lines without the code itself being written down.

Errors

Every failure is a TruecallerException carrying errorCode(), clientStatus() and a user-safe clientMessage().

Exception Meaning Status
CodeReplayedException code already exchanged — restart the SDK flow, do not retry 409
CodeRejectedException provider rejected the code or PKCE verifier 422
TokenRejectedException provider rejected the access token 422
ProfileIncompleteException no subject, or no phone number shared 422
PhoneUnsupportedException number not normalisable with confidence 422
UnavailableException provider 5xx/429, or a 200 with no token 503
TimeoutException connect or read timeout 503
NotConfiguredException no client id configured 503

isTransient() tells you whether retrying the same code could work; it is what drives the replay guard's release.

Security model

There is no signature to verify in the OAuth flow, so what makes this safe is: the authorization code is single-use at Truecaller, PKCE binds it to the app instance that began the flow, the replay guard stops it being spent twice, TLS protects it in transit, and TRUECALLER_CLIENT_ID stays secret and unlogged.

Access tokens are used once, in the request that obtained them, and are never cached.

Configuration to verify before production

The OAuth hosts, paths and userinfo field names come from Truecaller's developer portal and are the only values here not derivable from your own code. All are env-overridable, so confirming them is an ops change rather than a code change. The normaliser accepts phone_number as "+919876543210", "919876543210" or the JSON number 919876543210.

Tests

config.audit.block-insecure is disabled in composer.json because the dev tree resolves to the Laravel 8 line on PHP 8.0 — the versions this package must keep working against. It affects the test tree only.

Licence

MIT


All versions of laravel-truecaller-oauth with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
illuminate/support Version ^8.0|^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/http Version ^8.0|^9.0|^10.0|^11.0|^12.0|^13.0
guzzlehttp/guzzle Version ^7.0.1
illuminate/cache Version ^8.0|^9.0|^10.0|^11.0|^12.0|^13.0
psr/log Version ^1.0|^2.0|^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package kkxdev/laravel-truecaller-oauth contains the following files

Loading the files please wait ...