Download the PHP package foysal50x/h3-php without Composer

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

Build Status Tests Latest Stable Version

H3 PHP FFI Bindings

PHP FFI bindings for Uber's H3 hexagonal hierarchical geospatial indexing system.

Based on H3 v4.5.0 - the latest version as of May 2026.

Requirements

Installation

1. Enable PHP FFI Extension

The FFI extension must be enabled in your php.ini:

Note: ffi.enable can be set to:

To verify FFI is enabled:

2. Install the PHP Package

This package includes pre-built H3 libraries for common platforms:

The library will automatically detect and use the appropriate bundled binary.

3. (Optional) System H3 Library

If the bundled library doesn't work for your platform, you can install the H3 C library system-wide:

macOS (Homebrew):

Ubuntu/Debian:

From source:

Quick Start

API Reference

Indexing Functions

Inspection Functions

Traversal Functions

Hierarchy Functions

Directed Edge Functions

Vertex Functions

Measurement Functions

Utility Functions

Local IJ Coordinates

Error Handling

All methods that can fail will throw an H3Exception:

Common Exceptions

The library will throw H3Exception in these cases:

  1. FFI Extension Not Loaded

  2. FFI Not Enabled

  3. H3 Library Not Found

Custom Library Path

If the H3 library is not in a standard location:

Singleton Pattern

For convenience, you can use the singleton pattern:

Note: If you try to get an instance with a different library path than the existing singleton, an exception will be thrown. Call resetInstance() first if you need to change the library path.

Security & Safety Features

This library includes several security and safety measures to prevent common FFI-related vulnerabilities:

Input Validation

All user inputs are validated before being passed to the C library:

Memory Safety

Grid operations have configurable limits to prevent memory exhaustion:

Descriptive Error Messages

Exceptions include detailed error information:

Resolution Guide

Resolution Avg Hex Area Avg Edge Length
0 4,357,449.416 km² 1,281.256 km
1 609,788.441 km² 483.057 km
2 86,801.780 km² 182.512 km
3 12,393.434 km² 68.979 km
4 1,770.347 km² 26.071 km
5 252.903 km² 9.854 km
6 36.129 km² 3.724 km
7 5.161 km² 1.406 km
8 0.737 km² 531.414 m
9 0.105 km² 200.786 m
10 0.015 km² 75.863 m
11 0.002 km² 28.663 m
12 307.092 m² 10.830 m
13 43.870 m² 4.092 m
14 6.267 m² 1.546 m
15 0.895 m² 0.584 m

Running Tests

License

MIT License - see LICENSE file.

Links


All versions of h3-php with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
ext-ffi Version *
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 foysal50x/h3-php contains the following files

Loading the files please wait ...