mjaschen / phpgeo

Simple Yet Powerful Geo Library for PHP
https://phpgeo.marcusjaschen.de
MIT License
1.55k stars 195 forks source link

PHP Fatal error: Uncaught Error: Class "Location\Coordinate" not found in .... #85

Closed jwpv closed 2 years ago

jwpv commented 2 years ago

When running a php script a get this error: PHP Fatal error: Uncaught Error: Class "Location\Coordinate" not found in ... I am using php 8.1.1 (installed via XAMPP), installed the composer via the installer en ran composer require mjaschen/phpgeo. The script is a copy from the website:

<?php use Location\Coordinate; use Location\Distance\Vincenty; $coordinate1 = new Coordinate(19.820664, -155.468066); // Mauna Kea Summit $coordinate2 = new Coordinate(20.709722, -156.253333); // Haleakala Summit $calculator = new Vincenty(); echo $calculator->getDistance($coordinate1, $coordinate2); ?>

My noob fault. Added require 'vendor/autoload.php'; and it works now!