Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,48 @@ limitations under the License.

## Documentation

mapcode_library_php.doc - Manual: how to use the PHP Mapcode Library
mapcode_library_php.doc - Manual: how to use the PHP Mapcode Library (deprecated)
LICENSE - Apache License, Version 2.0
NOTICE - About this package
README.md - This document

## Example

This is an example of how to use this library as of version 2.3.0 via composer.

### Installing via Composer

```bash
$ composer require mapcodes/mapcodes
```

### Usage

```php

use Mapcode\Coord;

use function Mapcode\encodeInternational as mapcodeEncodeInternational;
use function Mapcode\decode as mapcodeDecode;

$arrayWithResult = mapcodeEncodeInternational(42.5077402, -83.1954047); // T8BBD.YLN0

$decoded = mapcodeDecode("T8BBD.YLN0"); // Returns `Mapcode\Coord` on successful decode

if($decoded instanceof Coord)
{
echo "{$decoded->lat}, {$decoded->lon}\n";
}

```

## Version History

### 2.3.0

* Updated to move everything into the `Mapcode` namespace, remove dependencies on global variables
* Added support for composer via composer.json

### 2.2.3

* Updated to support PHP version 8.1.4 (thanks, Bert Hooyman).
Expand Down
30 changes: 30 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "mapcodes/mapcodes",
"description": "The mapcodes SDK (https://www.mapcode.com/)",
"type": "library",
"version" : "2.3.0",
"require": {
},
"license": "Apache-2.0",
"autoload": {
"files" : [
"src/mapcode.php"
]
},
"prefer-stable": true,
"config": {
"sort-packages": true,
"preferred-install": "dist",
"allow-plugins": {}
},
"authors": [
{
"name": "Stichting Mapcode Foundation",
"homepage" : "https://mapcode.com"
},
{
"name": "John Coggeshall",
"email": "[email protected]"
}
]
}
Loading