{"id":13574966,"url":"https://github.com/abler98/h3-php","last_synced_at":"2025-04-04T19:30:25.197Z","repository":{"id":208153908,"uuid":"496385071","full_name":"abler98/h3-php","owner":"abler98","description":"PHP extension with H3 library bindings","archived":false,"fork":false,"pushed_at":"2024-09-11T16:05:05.000Z","size":103,"stargazers_count":11,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T14:49:55.630Z","etag":null,"topics":["h3","php"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abler98.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-25T20:46:40.000Z","updated_at":"2025-01-06T16:56:53.000Z","dependencies_parsed_at":"2024-11-05T10:58:05.227Z","dependency_job_id":null,"html_url":"https://github.com/abler98/h3-php","commit_stats":null,"previous_names":["abler98/h3-php"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abler98%2Fh3-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abler98%2Fh3-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abler98%2Fh3-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abler98%2Fh3-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abler98","download_url":"https://codeload.github.com/abler98/h3-php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247237606,"owners_count":20906314,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["h3","php"],"created_at":"2024-08-01T15:00:57.088Z","updated_at":"2025-04-04T19:30:24.633Z","avatar_url":"https://github.com/abler98.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"# H3 PHP\n\nPHP extension that implements [H3 library](https://github.com/uber/h3) bindings in OOP style\n\n# Requirements\n\n* PHP: `^8.1`\n* H3 Library: `^3.7.2`\n\n# Examples\n\n```php\n\u003c?php\n\nuse H3\\GeoCoord;\nuse H3\\H3Index;\nuse function H3\\compact as h3_compact;\nuse function H3\\edge_length;\n\n$h3 = new H3Index(0x881196404bfffff);\n// or\n$h3 = H3Index::fromLong(0x881196404bfffff);\n// or\n$h3 = H3Index::fromString('881196404bfffff');\n// or\n$h3 = H3Index::fromGeo(geo: new GeoCoord(lat: 50.00572553034654, lon: 36.229191466601634), res: 8);\n\n$resolution = $h3-\u003egetResolution(); // 8\n$kRing = $h3-\u003ekRing(k: 3); // H3Index[]\n$kRingCount = count($kRing); // 37\n$compacted = h3_compact($kRing); // H3Index[]\n$compactedCount = count($compacted); // 19\n$parentString = $h3-\u003etoParent(res: 5)-\u003etoString(); // \"85119643fffffff\"\n\n$edgeLength = edge_length(res: 8, unit: H3_LENGTH_UNIT_M); // 461.3546837\n```\n\n# Building from source\n\n## H3 Library\n\n```bash\ngit clone https://github.com/uber/h3.git\ncd h3\ngit checkout v3.7.2\ncmake -DBUILD_SHARED_LIBS=ON .\nmake -j \"$(nproc)\"\nsudo make install\n```\n\n## PHP Extension\n\n```bash\ngit clone https://github.com/abler98/h3-php.git\ncd h3-php\nphpize\n./configure\nmake\nsudo make install\n```\n\n# Binding table\n\n## Indexing\n| C                 | PHP                         |\n|-------------------|-----------------------------|\n| geoToH3()         | H3\\H3Index::fromGeo()       |\n| h3ToGeo()         | H3\\H3Index::toGeo()         |\n| h3ToGeoBoundary() | H3\\H3Index::toGeoBoundary() |\n\n## Inspection\n| C                 | PHP                         |\n|-------------------|-----------------------------|\n| h3GetResolution() | H3\\H3Index::getResolution() |\n| h3GetBaseCell()   | H3\\H3Index::getBaseCell()   |\n| stringToH3()      | H3\\H3Index::fromString()    |\n| h3ToString()      | H3\\H3Index::toString()      |\n| h3IsValid()       | H3\\H3Index::isValid()       |\n| h3IsResClassIII() | H3\\H3Index::isResClassIII() |\n| h3IsPentagon()    | H3\\H3Index::isPentagon()    |\n| h3GetFaces()      | H3\\H3Index::getFaces()      |\n| maxFaceCount()    | -                           |\n\n## Traversal\n| C                         | PHP                                           |\n|---------------------------|-----------------------------------------------|\n| kRing()                   | H3\\H3Index::kRing()                           |\n| maxKringSize()            | -                                             |\n| kRingDistances()          | H3\\H3Index::kRingDistances()                  |\n| hexRange()                | H3\\H3Index::hexRange()                        |\n| hexRangeDistances()       | H3\\H3Index::hexRangeDistances()               |\n| hexRanges()               | H3\\H3Index::hexRanges()                       |\n| hexRing()                 | H3\\H3Index::hexRing()                         |\n| h3Line()                  | H3\\line()\u003cbr/\u003eH3\\H3Index::getLineTo()         |\n| h3LineSize()              | -                                             |\n| h3Distance()              | H3\\distance()\u003cbr/\u003eH3\\H3Index::getDistanceTo() |\n| experimentalH3ToLocalIj() | H3\\experimental_h3_to_local_ij                |\n| experimentalLocalIjToH3() | H3\\experimental_local_ij_to_h3                |\n\n## Hierarchy\n| C                     | PHP                         |\n|-----------------------|-----------------------------|\n| h3ToParent()          | H3\\H3Index::toParent()      |\n| h3ToChildren()        | H3\\H3Index::toChildren()    |\n| maxH3ToChildrenSize() | -                           |\n| h3ToCenterChild()     | H3\\H3Index::toCenterChild() |\n| compact()             | H3\\compact()                |\n| uncompact()           | H3\\uncompact()              |\n| maxUncompactSize()    | -                           |\n\n## Regions\n| C                      | PHP                          |\n|------------------------|------------------------------|\n| polyfill()             | H3\\polyfill()                |\n| maxPolyfillSize()      | -                            |\n| h3SetToLinkedGeo()     | H3\\h3_set_to_multi_polygon() |\n| destroyLinkedPolygon() | -                            |\n\n## Unidirectional edges\n| C                                             | PHP                                                     |\n|-----------------------------------------------|---------------------------------------------------------|\n| h3IndexesAreNeighbors()                       | H3\\indexes_are_neighbors\u003cbr/\u003eH3\\H3Index::isNeighborTo() |\n| getH3UnidirectionalEdge()                     | H3\\H3Index::getUnidirectionalEdge()                     |\n| h3UnidirectionalEdgeIsValid()                 | H3\\UniEdge::isValid()                                   |\n| getOriginH3IndexFromUnidirectionalEdge()      | H3\\UniEdge::getOrigin()                                 |\n| getDestinationH3IndexFromUnidirectionalEdge() | H3\\UniEdge::getDestination()                            |\n| getH3IndexesFromUnidirectionalEdge()          | H3\\UniEdge::getIndexes()                                |\n| getH3UnidirectionalEdgesFromHexagon()         | H3\\H3Index::getUnidirectionalEdges()                    |\n| getH3UnidirectionalEdgeBoundary()             | H3\\UniEdge::getBoundary()                               |\n\n## Miscellaneous\n| C                     | PHP                       |\n|-----------------------|---------------------------|\n| degsToRads()          | H3\\degs_to_rads()         |\n| radsToDegs()          | H3\\rads_to_degs()         |\n| hexAreaKm2()          | H3\\hex_area()             |\n| hexAreaM2()           | H3\\hex_area()             |\n| cellAreaM2()          | H3\\H3Index::getCellArea() |\n| cellAreaRads2()       | H3\\H3Index::getCellArea() |\n| edgeLengthKm()        | H3\\edge_length()          |\n| edgeLengthM()         | H3\\edge_length()          |\n| exactEdgeLengthKm()   | H3\\UniEdge::getLength()   |\n| exactEdgeLengthM()    | H3\\UniEdge::getLength()   |\n| exactEdgeLengthRads() | H3\\UniEdge::getLength()   |\n| numHexagons()         | H3\\num_hexagons()         |\n| getRes0Indexes()      | H3\\get_res0_indexes()     |\n| res0IndexCount()      | -                         |\n| getPentagonIndexes()  | H3\\get_pentagon_indexes() |\n| pentagonIndexCount()  | -                         |\n| pointDistKm()         | H3\\point_dist()           |\n| pointDistM()          | H3\\point_dist()           |\n| pointDistRads()       | H3\\point_dist()           |\n\n# License\n\nAll contents of this package are licensed under the [MIT license].\n\n[MIT license]: LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabler98%2Fh3-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabler98%2Fh3-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabler98%2Fh3-php/lists"}