Download the PHP package itxshakil/aadhaar-offline without Composer

On this page you can find all versions of the php package itxshakil/aadhaar-offline. 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 aadhaar-offline

Aadhaar Offline for PHP

Latest Version Total Downloads Tests License

Read and verify Aadhaar Offline e-KYC files and Aadhaar Secure QR codes in any PHP application, with no framework required. It opens the share-code-protected ZIP, checks UIDAI's digital signature locally against certificates you pin, and gives you a typed object with the resident's name, date of birth, gender, address and photo. It can also confirm a mobile number or email against the hashes in the file, and it never needs the full Aadhaar number.

Don't trust the XML, verify it. Many integrations accept whatever XML a KYC vendor returns, or whatever ZIP a user uploads, without checking the signature. Anyone can edit an XML file. This package checks the signature against UIDAI's public certificate before you rely on any of the data.

Using Laravel? Install itxshakil/laravel-aadhaar-offline. It builds on this package and adds a facade, validation rules, Artisan commands, events, an upload form and a test fake.

Status: 0.x. The test suite uses synthetic, self-signed fixtures. The Offline e-KYC ZIP path has also been checked against a real 2026 UIDAI download and UIDAI's published uidai_offline_publickey_2026.cer. Secure QR follows UIDAI's published layout and well-maintained open-source decoders, but has not yet been checked against a real card. Please open an issue if anything differs.


Features


Requirements

Requirement Version
PHP ^8.3 with ext-dom, ext-openssl, ext-zip, ext-zlib
UIDAI public certificate From UIDAI's Data and Downloads page

Quick Start

Download uidai_offline_publickey_2026.cer from UIDAI and check its fingerprint first; see docs/installation.md.


Reading Payloads

Every reader returns an unverified OfflineKyc. Call verify(), or use the verify* shortcuts.

What you get

Method Returns
name() ?string
dob() ?DateTimeImmutable, or null when only the year is present
dateOfBirthRaw() / birthYear() / age() ?string / ?int / ?int
gender() ?Gender (Male, Female, Transgender)
address() Address with careOf, house, street, landmark, locality, vtc, postOffice, subDistrict, district, state, country, pincode, formatted()
photo() ?Photo with toDataUri(), contents(), mimeType(), extension()
referenceId() UIDAI reference ID (last 4 digits + timestamp)
lastFourDigits() / maskedAadhaar() "5678" / "XXXX XXXX 5678"
generatedAt() / ageInDays() / isFresh($days) When UIDAI generated the payload
hasMobile() / hasEmail() Whether a mobile/email hash is present
source() PayloadSource::Xml or PayloadSource::SecureQr
mobileLastFourDigits() Last four mobile digits, from Secure QR version 2 and later. Not in toArray()
isVerified() Whether verify() succeeded on this instance
toArray($withPhoto = false) Privacy-safe array

Verification

verify() runs two checks and throws on the first failure:

  1. Signature. For XML, the document must contain exactly one enveloped signature, directly under the root, with a single reference covering the whole document (URI=""). For Secure QR codes, the 256-byte RSA signature must cover every byte before it. Either way, the signature is checked against your configured certificates only, never a key embedded in the file.
  2. Freshness. The timestamp in the reference ID must be within maxAgeDays for XML (default 3) or qrMaxAgeDays for QR codes (off by default, because printed cards are old).

For audit logs, pass onVerified and onRejected callbacks to create(). Log referenceId(), maskedAadhaar() and the exception class, never the payload itself.

How it works in detail: docs/verification.md


Matching Mobile and Email

The file doesn't contain the mobile number or email, only hashes. Ask the user for their number and check it:

For Offline e-KYC XML the hash is SHA-256 of value + shareCode, repeated N times, where N is the last digit of the Aadhaar number (0 and 1 both mean once). Matching needs the share code, so pass it to fromXml() when you use vendor XML. Legacy Secure QR codes use the same scheme without the share code; version 2 and later carry only mobileLastFourDigits().

Only trust a match after verify(). A forged file can contain any hash.


Privacy

For format-only checks, use AadhaarNumber::isValid() and Verhoeff::validate() from Shakil\AadhaarOffline\Support.

More: docs/privacy.md


Testing

Never use real Aadhaar data in tests. Shakil\AadhaarOffline\Testing\Fixtures builds signed synthetic ZIPs, XML and Secure QR codes with a key generated at runtime, and OfflineKycFactory builds OfflineKyc objects directly.

Full testing guide: docs/testing.md


Error Handling

Every exception extends Shakil\AadhaarOffline\Exceptions\AadhaarOfflineException.

Exception Meaning
InvalidShareCodeException Share code isn't 4 digits or doesn't open the ZIP
MalformedPayloadException Not a ZIP, wrong number of entries, too large, not well-formed XML, DOCTYPE present, or not an Offline e-KYC document. For QR codes: not a Secure QR number, corrupt, truncated, or an unsupported version
InvalidSignatureException Missing, duplicated, edited or untrusted signature, on XML or QR
StaleKycException Older than maxAgeDays (XML) or qrMaxAgeDays (QR)
ConfigurationException No certificate configured, certificate unreadable, or share code missing for hash matching

Contributing

Contributions are welcome. See CONTRIBUTING.md. Report security issues privately as described in SECURITY.md.

Never commit real Aadhaar data, Offline e-KYC files or private keys. The test suite generates its own keys and synthetic payloads.


License

The MIT License (MIT). See LICENSE.md.

This package is not affiliated with or endorsed by UIDAI. "Aadhaar" is used only to describe compatibility.


All versions of aadhaar-offline with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
ext-dom Version *
ext-libxml Version *
ext-openssl Version *
ext-zip Version *
ext-zlib Version *
robrichards/xmlseclibs Version ^4.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 itxshakil/aadhaar-offline contains the following files

Loading the files please wait ...