Skip to content

taxQuery

A function which returns an array of tax names corresponding to the work and home addresses.

Syntax

value = taxQuery ( $work_address, $home_address, $url, $nexus )

  • value - A string array result.
  • $work_address - A string indicating the employee's workplace address.
  • $home_address - A string indicating the employee's residence address.
  • $url - A string indicating the location of the Docker TaxQuery container. For example 'https://example.com:8443' or 'localhost:8000'.
  • $nexus - A string expression indicating the states where the employer has nexus (loosely, a physical presence, such as office space). This should be in the form of a space-delimited list of 2-letter USPS state abbreviations. For example, 'OH KY PA'. Default value is the workplace state.

For some (especially local) tax jurisdictions, the taxNamesForZip function does not provide enough granularity to precisely identify tax names. For such situations, this function invokes the TaxQuery Docker container, which returns a string array like taxNamesForZip, but with greater precision.

Note: This function requires a running instance of the TaxQuery Docker container:

Terminal window
docker run -p 8000:8000 calibertechnology/taxquery

See the TaxQuery page on the Docker hub for more information.

Once you have a running container, set the $url parameter to the address of your instance. For the docker invocation above, this would be localhost:8000 or http://localhost:8000.

Example

Get the taxes for an employee based on addresses:

<?php
include 'taxes.php';
$url = "http://localhost:8000";
$work = "1400 Defense Blvd, Washington, VA 20301";
// using Plus Code with ZIP for home:
$home = "RQ6F+JJ 17325";
$names = taxQuery($work, $home, $url, "PA MD VA DC");
foreach ($names as $name){
print "$name\n";
}
?>

Note: If you are using the demo PHP software or have a Level 1 subscription, this method may return local tax names for Ohio or Pennsylvania which are not included in the taxList() array.