Skip to content

A utility class to convert US ZIP codes to 'tz' timezone strings.

License

Unknown, Unknown licenses found

Licenses found

Unknown
LICENSE
Unknown
LICENSE.asc
Notifications You must be signed in to change notification settings

angorb/zipcode-timezone-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zipcode-timezone-php

An overbuilt utility class to convert US ZIP codes to 'tz' timezone strings.

Example:

// import the Timezone class
require_once "/path/to/Timezone.php";

// specify whether or not to use the compressed zipcode data file
// default: false
$timezone = new \Angorb\ZipCodeTimezone\Timezone(true);

echo $timezone->getForZipCode(90120); // prints 'America/Los_Angeles'

echo $timezone->getForZipCode(00000); // invalid ZIP code - prints (bool) 'false' 

// if you're not super concerned with optimization because you have few lookups
// to do, a static method exists
echo \Angorb\ZipCodeTimezone\TimezoneForZip::get(10001); // prints 'America/New_York'

Compressed File Security:

MD5: c4fc51c364cf39c509eba37df01aeb0d To verify the gz compressed database matches the plaintext database in the distribution: $ php -f tests/compressed_datafile_integrity_check.php

Passed:

Uncompressed Checksum:  c4fc51c364cf39c509eba37df01aeb0d    Path: /Users/angorb/Sites/zipcode-timezone-php/data/ziptzdb.json
Compressed Checksum:    c4fc51c364cf39c509eba37df01aeb0d    Path: /Users/angorb/Sites/zipcode-timezone-php/data/ziptzdb.json.gz
OK: Compressed and uncompressed files match.

Failed:

Uncompressed Checksum:  a8f3d499c499ea925a5ca835c436eb1f    Path: /Users/angorb/Sites/zipcode-timezone-php/data/ziptzdb.json
Compressed Checksum:    c4fc51c364cf39c509eba37df01aeb0d    Path: /Users/angorb/Sites/zipcode-timezone-php/data/ziptzdb.json.gz
WARNING: Compressed and uncompressed files DO NOT match!

About

A utility class to convert US ZIP codes to 'tz' timezone strings.

Resources

License

Unknown, Unknown licenses found

Licenses found

Unknown
LICENSE
Unknown
LICENSE.asc

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages