Download the PHP package khush/india-pincodes without Composer

On this page you can find all versions of the php package khush/india-pincodes. 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 india-pincodes

khush/india-pincodes

Offline India PIN code lookup for PHP. No API calls, no database: the data ships as plain PHP arrays, split into one file per 3-digit prefix, so a lookup loads only one small file (and OPcache keeps it).

Install

Use

find() returns null for malformed and unknown PINs. Pass a folder to the constructor to read your own data (same layout as data/), e.g. a fixture in tests. The layout of the data files isn't part of the public API and can change in any release.

What's in an office

Key Value
office Office name, without the type suffix India Post adds (Kothimir B.O → Kothimir). Otherwise as published, so some names are in capitals or carry other abbreviations.
type HO head office, PO sub office, BO branch office (PincodeLookup::TYPE_*).
delivery true if the office delivers mail.
district District name. All-capital names are converted to title case; the rest are as published. null if India Post has none.
state ISO 3166-2:IN code, i.e. TS. null if India Post has none.

Things to know about the data

The package returns what India Post publishes and doesn't guess. So:

Performance and OPcache

Each find() call loads the data file for the PIN's first three digits (at most about 90 KB) with require, and keeps the last file it read. With OPcache on, that file is compiled once and later calls read it from shared memory, so lookups are cheap.

OPcache is on by default for web requests (PHP-FPM, Apache) but off by default on the command line. For CLI scripts or queue workers that look up many PINs, turn it on in php.ini:

Without it, every call for a different prefix re-parses its file: still correct, just slower for bulk lookups.

Regenerating the data

data.gov.in republishes the directory from time to time. To refresh, run from a clone of this repo (not from vendor/):

  1. Download the CSV from https://www.data.gov.in/resource/all-india-pincode-directory-till-last-month. The site asks for a name, email and captcha, so this step is done in the browser.
  2. Run the generator:

  3. Update the version date in data/NOTICE.md.

The generator stops on a value it doesn't know (a new state, office type or delivery status) instead of guessing. A new or renamed state goes into src/IndiaState.php first.

Data refreshes and cleaning fixes are released as minor versions. A change to the keys, value types or null rules of an office, or to a method signature, is a major version.

Licence

Code: MIT. Data: see data/NOTICE.md (India Post via data.gov.in, GODL-India - attribution required).


All versions of india-pincodes with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
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 khush/india-pincodes contains the following files

Loading the files please wait ...