Port of s2-geometry-library-java into PHP