PHPackages                             surfoo/geocaching-php-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. surfoo/geocaching-php-sdk

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

surfoo/geocaching-php-sdk
=========================

Geocaching PHP SDK

4.0.0(6d ago)143.5k↑237.5%71MITPHPPHP ^8.2CI passing

Since Jun 27Pushed 6d ago3 watchersCompare

[ Source](https://github.com/Surfoo/geocaching-php-sdk)[ Packagist](https://packagist.org/packages/surfoo/geocaching-php-sdk)[ Docs](https://geocaching.vaguelibre.net/api/)[ RSS](/packages/surfoo-geocaching-php-sdk/feed)WikiDiscussions develop Synced 5d ago

READMEChangelog (10)Dependencies (34)Versions (37)Used By (1)

Geocaching PHP SDK
==================

[](#geocaching-php-sdk)

[![Latest Stable Version](https://camo.githubusercontent.com/13b9f37ab77f3dffdcf3617b7796593f96ba9315adfdd9f8cdbbf8092b754fbb/68747470733a2f2f706f7365722e707567782e6f72672f737572666f6f2f67656f63616368696e672d7068702d73646b2f762f737461626c652e737667)](https://packagist.org/packages/surfoo/geocaching-php-sdk)[![Total Downloads](https://camo.githubusercontent.com/74b02337f87ed52185a702c5186bf24f866d78908dfd248c1ca79626d7828c3c/68747470733a2f2f706f7365722e707567782e6f72672f737572666f6f2f67656f63616368696e672d7068702d73646b2f646f776e6c6f6164732e737667)](https://packagist.org/packages/surfoo/geocaching-php-sdk)[![Latest Unstable Version](https://camo.githubusercontent.com/f0cccdd415ef618f5d4c435691f75491a7a9e8e9a0b417c7ad466a4a72187ca7/68747470733a2f2f706f7365722e707567782e6f72672f737572666f6f2f67656f63616368696e672d7068702d73646b2f762f756e737461626c652e737667)](https://packagist.org/packages/surfoo/geocaching-php-sdk)

The documentation about the API is available here:

-
-

You can follow changes about the documentation and the API here:

-

Requirements
------------

[](#requirements)

- PHP &gt;= 8.2
- [composer](https://getcomposer.org/doc/00-intro.md#system-requirements).

Composer
--------

[](#composer)

From the command line:

```
composer require surfoo/geocaching-php-sdk

```

Using the PHP SDK
-----------------

[](#using-the-php-sdk)

First, you must have your API key from Groundspeak, but access to the API are no longer open.

You can find an example of implementation (with OAuth 2) in this repository:

Documentation
-------------

[](#documentation)

Start with [`docs/README.md`](./docs/README.md) for getting started, authentication, configuration, reliability patterns, and domain-by-domain API examples.

HTTP Request/Response Logging
-----------------------------

[](#http-requestresponse-logging)

The SDK provides comprehensive HTTP logging capabilities to help with debugging and monitoring API interactions. The logging feature includes:

- **Request/Response Correlation**: Each request gets a unique ID to match requests with their responses
- **Automatic Token Masking**: Sensitive authentication tokens are automatically masked for security
- **Configurable Detail Levels**: Choose what information to log (headers, bodies, timing)
- **Status-based Log Levels**: Automatic log level adjustment based on HTTP status codes
- **Performance Metrics**: Request duration tracking in milliseconds

### Quick Setup

[](#quick-setup)

```
use Geocaching\Enum\Environment;
use Geocaching\GeocachingSdk;
use Geocaching\Options;
use Psr\Log\LogLevel;

// Initialize SDK options
$options = new Options([
    'environment' => Environment::STAGING,
    'access_token' => 'your_token_here',
]);

// Enable HTTP logging (automatically configured with proper PSR-3 support)
$options->enableHttpLogging(
    'php://stdout',    // Output destination (console, file path, etc.)
    LogLevel::INFO,    // Log level (DEBUG, INFO, WARNING, ERROR)
    false,            // Log request/response bodies (true/false)
    true,             // Mask sensitive tokens (true/false)
    1000              // Max body length before truncation
);

// Create SDK instance
$sdk = new GeocachingSdk($options);

// All API calls will now be logged
$response = $sdk->ping();

// Optional: Enable automatic token refresh
use League\OAuth2\Client\Provider\Geocaching as OAuthProvider;

$oauthProvider = new OAuthProvider([
    'clientId'     => 'your_client_id',
    'clientSecret' => 'your_client_secret',
    'redirectUri'  => 'https://your-app.com/callback',
    'environment'  => 'production',
]);

$options->enableTokenRefresh([
    'reference_code' => 'PR12345',           // User reference code
    'storage'        => $tokenStorage,        // TokenStorageInterface implementation
    'oauth_provider' => $oauthProvider,
]);

// Or let the SDK create the OAuth provider automatically:
$options->enableTokenRefreshWithCredentials([
    'reference_code' => 'PR12345',
    'storage'        => $tokenStorage,
    'client_id'      => 'your_client_id',
    'client_secret'  => 'your_client_secret',
    'redirect_uri'   => 'https://your-app.com/callback',
    'environment'    => 'production',
]);
```

### Configuration Options

[](#configuration-options)

#### Simple Logging (enableHttpLogging)

[](#simple-logging-enablehttplogging)

ParameterTypeDefaultDescription`$output``string``'php://stdout'`Output destination (console, file path, etc.)`$level``string``LogLevel::INFO`Base log level for successful requests`$logBodies``bool``false`Whether to include request/response bodies`$maskTokens``bool``true`Automatically mask sensitive authentication data`$maxBodyLength``int``1000`Maximum body length before truncation`$logFormat``string|null``null`Custom log format (null for default)#### Advanced Logging (enableHttpLoggingWithLogger)

[](#advanced-logging-enablehttploggingwithlogger)

ParameterTypeDefaultDescription`$logger``LoggerInterface`*required*Custom PSR-3 compatible logger`$level``string``LogLevel::INFO`Base log level for successful requests`$logBodies``bool``false`Whether to include request/response bodies`$maskTokens``bool``true`Automatically mask sensitive authentication data`$maxBodyLength``int``1000`Maximum body length before truncation### Log Output Example

[](#log-output-example)

```
[2025-01-15 10:30:15] geocaching-api.INFO: [GEOCACHING] HTTP Request: GET https://staging.api.groundspeak.com/v1/users/PR12345 {"request_id":"req_65a5b2f7c8d9e","method":"GET","uri":"https://staging.api.groundspeak.com/v1/users/PR12345","headers":{"authorization":["***"],"content-type":["application/json"]}}

[2025-01-15 10:30:15] geocaching-api.INFO: [GEOCACHING] HTTP Response: 200 OK (245.67ms) {"request_id":"req_65a5b2f7c8d9e","status_code":200,"duration_ms":245.67,"reason_phrase":"OK","headers":{"content-type":["application/json"],"x-ratelimit-remaining":["999"]}}

```

### Security Features

[](#security-features)

- **Token Masking**: Automatically masks tokens in URLs (`access_token=***`) and headers (`Authorization: ***`)
- **Selective Header Logging**: Only logs relevant response headers, excluding sensitive information
- **Body Truncation**: Large request/response bodies are truncated to prevent log flooding

### Advanced Usage

[](#advanced-usage)

#### Using a Custom Logger

[](#using-a-custom-logger)

For full control over logging behavior:

```
use Monolog\Logger;
use Monolog\Handler\RotatingFileHandler;
use Monolog\Processor\UidProcessor;

// Create custom logger with rotating files and unique request IDs
$customLogger = new Logger('geocaching-api');
$customLogger->pushHandler(new RotatingFileHandler('logs/geocaching.log', 7));
$customLogger->pushProcessor(new UidProcessor());

// Use custom logger
$options->enableHttpLoggingWithLogger(
    $customLogger,
    LogLevel::DEBUG,
    true,  // Log bodies
    true,  // Mask tokens
    2000   // Max body length
);
```

#### Custom Log Format

[](#custom-log-format)

You can customize the log format:

```
$options->enableHttpLogging(
    'logs/api.log',
    LogLevel::INFO,
    false,
    true,
    1000,
    "[%datetime%] %level_name%: %message%\n" // Custom format
);
```

#### Multiple Output Destinations

[](#multiple-output-destinations)

```
// Log to console for development
$options->enableHttpLogging('php://stdout', LogLevel::DEBUG);

// Or log to file for production
$options->enableHttpLogging('/var/log/geocaching-api.log', LogLevel::WARNING);
```

Contributing
------------

[](#contributing)

All contributions are welcome! Feel free to submit pull requests, issues or ideas :-)

###  Health Score

62

—

FairBetter than 99% of packages

Maintenance98

Actively maintained with recent releases

Popularity31

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity87

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~133 days

Recently: every ~308 days

Total

34

Last Release

6d ago

Major Versions

1.2 → v2.02016-12-20

2.0.2 → 3.0.02018-10-05

3.20.0 → 4.0.0-rc2023-08-18

3.21.0 → 4.0.02026-06-28

PHP version history (11 changes)1.0PHP &gt;=5.4

v2.0PHP ~5.6 || ~7.0

3.0.0PHP ~7.1

3.9.0PHP ~7.2

3.10.0PHP ~7.3

3.12.0PHP ^7.3

3.13.0PHP ^7.3 || ^8.0

3.18.0PHP ^7.3 || ^8.0 || ^8.1

3.19.0PHP ^7.3 || ^8.0 || ^8.1 || ^8.2

4.0.0-rcPHP ^8.1

4.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/aa8e8e1aa2d80dc4165f74c572bd01e4228cd7a7c82142d8651a62b0ab182fef?d=identicon)[Surfoo](/maintainers/Surfoo)

---

Top Contributors

[![Surfoo](https://avatars.githubusercontent.com/u/553659?v=4)](https://github.com/Surfoo "Surfoo (205 commits)")

---

Tags

apigeocachinggroundspeakphpsdkphpapisdkoauthgeocachinggroundspeakgeocache

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/surfoo-geocaching-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/surfoo-geocaching-php-sdk/health.svg)](https://phpackages.com/packages/surfoo-geocaching-php-sdk)
```

###  Alternatives

[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

35789.4k2](/packages/telnyx-telnyx-php)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

85036.3k](/packages/flow-php-flow)[openai-php/client

OpenAI PHP is a supercharged PHP API client that allows you to interact with the Open AI API

5.8k28.0M318](/packages/openai-php-client)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[getbrevo/brevo-php

Official Brevo provided RESTFul API V3 php library

1003.9M50](/packages/getbrevo-brevo-php)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M577](/packages/shopware-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
