Skip to content

Commit eb30ab5

Browse files
authored
Merge pull request #311 from maxmind/greg/stf-557
Validate and update links (STF-557)
2 parents c7f5661 + 174ee29 commit eb30ab5

12 files changed

Lines changed: 138 additions & 16 deletions

File tree

.github/workflows/links.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Links
2+
3+
on:
4+
push:
5+
pull_request:
6+
schedule:
7+
- cron: "0 13 * * 1" # weekly, to catch external link rot without a commit
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
linkChecker:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
18+
with:
19+
persist-credentials: false
20+
21+
- name: Setup mise
22+
uses: jdx/mise-action@6d1e696aa24c1aa1bcc1adea0212707c71ab78a8 # v3.6.1
23+
with:
24+
install: false
25+
26+
# Install only lychee (not the repo's full toolchain) and run the check.
27+
- name: Check links
28+
env:
29+
MISE_AUTO_INSTALL: "false"
30+
run: |
31+
mise install lychee
32+
mise run check-links

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ vendor/
2424
# Claude Code directories
2525
.claude/
2626
.claude_cache/
27+
.lycheecache

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,6 @@ vendor/bin/phpunit
323323
## Additional Resources
324324

325325
- [API Documentation](https://maxmind.github.io/GeoIP2-php/)
326-
- [GeoIP Web Services Docs](https://dev.maxmind.com/geoip/docs/web-services)
326+
- [GeoIP Web Services Docs](https://dev.maxmind.com/geoip/docs/web-services/)
327327
- [MaxMind DB Format](https://maxmind.github.io/MaxMind-DB/)
328328
- GitHub Issues: https://github.com/maxmind/GeoIP2-php/issues

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
## Description
44

55
This package provides an API for the GeoIP and GeoLite
6-
[web services](https://dev.maxmind.com/geoip/docs/web-services?lang=en) and
7-
[databases](https://dev.maxmind.com/geoip/docs/databases?lang=en).
6+
[web services](https://dev.maxmind.com/geoip/docs/web-services/?lang=en) and
7+
[databases](https://dev.maxmind.com/geoip/docs/databases/?lang=en).
88

99
## Install via Composer
1010

@@ -45,18 +45,18 @@ require 'vendor/autoload.php';
4545
## Install via Phar
4646

4747
Although we strongly recommend using Composer, we also provide a
48-
[phar archive](https://php.net/manual/en/book.phar.php) containing most of the
48+
[phar archive](https://www.php.net/manual/en/book.phar.php) containing most of the
4949
dependencies for GeoIP. Our latest phar archive is available on
5050
[our releases page](https://github.com/maxmind/GeoIP2-php/releases).
5151

5252
### Install Dependencies
5353

5454
In order to use the phar archive, you must have the PHP
55-
[Phar extension](https://php.net/manual/en/book.phar.php) installed and
55+
[Phar extension](https://www.php.net/manual/en/book.phar.php) installed and
5656
enabled.
5757

5858
If you will be making web service requests, you must have the PHP
59-
[cURL extension](https://php.net/manual/en/book.curl.php) installed to use
59+
[cURL extension](https://www.php.net/manual/en/book.curl.php) installed to use
6060
this archive. For Debian-based distributions, this can typically be found in
6161
the `php-curl` package. For other operating systems, please consult the
6262
relevant documentation. After installing the extension you may need to restart
@@ -286,7 +286,7 @@ print($record->network . "\n"); // '128.101.101.101/32'
286286

287287
You can keep your databases up to date with our
288288
[GeoIP Update program](https://github.com/maxmind/geoipupdate/releases).
289-
[Learn more about GeoIP Update on our developer portal.](https://dev.maxmind.com/geoip/updating-databases?lang=en)
289+
[Learn more about GeoIP Update on our developer portal.](https://dev.maxmind.com/geoip/updating-databases/?lang=en)
290290

291291
## Web Service Client
292292

@@ -398,7 +398,7 @@ Because of these factors, it is possible for any endpoint to return a record
398398
where some or all of the attributes are unpopulated.
399399

400400
See the
401-
[GeoIP web service docs](https://dev.maxmind.com/geoip/docs/web-services?lang=en)
401+
[GeoIP web service docs](https://dev.maxmind.com/geoip/docs/web-services/?lang=en)
402402
for details on what data each endpoint may return.
403403

404404
The only piece of data which is always returned is the `ipAddress` attribute
@@ -422,7 +422,7 @@ GeoNames premium data set.
422422
## Reporting data problems
423423

424424
If the problem you find is that an IP address is incorrectly mapped, please
425-
[submit your correction to MaxMind](https://www.maxmind.com/en/correction).
425+
[submit your correction to MaxMind](https://www.maxmind.com/en/geoip-data-correction-request).
426426

427427
If you find some other sort of mistake, like an incorrect spelling, please
428428
check the [GeoNames site](https://www.geonames.org/) first. Once you've
@@ -433,15 +433,15 @@ automatically incorporated into future MaxMind releases.
433433

434434
If you are a paying MaxMind customer and you're not sure where to submit a
435435
correction, please
436-
[contact MaxMind support](https://www.maxmind.com/en/support) for help.
436+
[contact MaxMind support](https://support.maxmind.com/knowledge-base) for help.
437437

438438
## Other Support
439439

440440
Please report all issues with this code using the
441441
[GitHub issue tracker](https://github.com/maxmind/GeoIP2-php/issues).
442442

443443
If you are having an issue with a MaxMind service that is not specific to the
444-
client API, please see [our support page](https://www.maxmind.com/en/support).
444+
client API, please see [our support page](https://support.maxmind.com/knowledge-base).
445445

446446
## Requirements
447447

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
{
1010
"name": "Gregory J. Oschwald",
1111
"email": "goschwald@maxmind.com",
12-
"homepage": "https://www.maxmind.com/"
12+
"homepage": "https://www.maxmind.com/en/home"
1313
}
1414
],
1515
"require": {

lychee.toml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Lychee link checker configuration
2+
# https://lychee.cli.rs/#/usage/config
3+
#
4+
# Run locally with:
5+
# lychee './**/*.md' './src/**/*.php' './composer.json'
6+
7+
# Include URL fragments in checks
8+
include_fragments = true
9+
10+
# Don't allow any redirects, so links that have moved are surfaced and updated
11+
# to their canonical destination.
12+
max_redirects = 0
13+
14+
# Accept these HTTP status codes
15+
# 100-103: Informational responses
16+
# 200-299: Success responses
17+
# 403: Forbidden (some sites use this for rate limiting)
18+
# 429: Too Many Requests
19+
# 500-599: Server errors (temporary issues shouldn't fail CI)
20+
# 999: LinkedIn's custom status code
21+
accept = ["100..=103", "200..=299", "403", "429", "500..=599", "999"]
22+
23+
# Exclude URL patterns from checking (treated as regular expressions)
24+
exclude = [
25+
'^file://',
26+
# Live / auth-gated endpoints that appear as string literals or require login
27+
'^https://geoip\.maxmind\.com',
28+
'^https://geolite\.info',
29+
'^https://minfraud\.maxmind\.com',
30+
'^https://sandbox\.maxmind\.com',
31+
'^https://updates\.maxmind\.com',
32+
'^https://www\.maxmind\.com/en/accounts/',
33+
'https://www\.maxmind\.com/en/account/login',
34+
# Placeholders / local
35+
'^https?://example\.(com|org|net)',
36+
'^http://localhost',
37+
'127\.0\.0\.1',
38+
]
39+
40+
# Exclude file paths from getting checked (treated as regular expressions)
41+
exclude_path = [
42+
'(^|/)node_modules/',
43+
'(^|/)vendor/',
44+
# Generated Hugo docs site committed under docs/public
45+
'(^|/)docs/public/',
46+
'(^|/)\.git/',
47+
# Changelog: historical entries are preserved as-is, not rewritten
48+
'(^|/)CHANGELOG\.md$',
49+
]
50+
51+
# Cache results for 1 day to speed up repeated checks
52+
cache = true
53+
max_cache_age = "1d"
54+
55+
# Skip missing input files instead of erroring
56+
skip_missing = true

mise.lock

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mise.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ disable_backends = [
77

88
[tools]
99
hugo = "latest"
10+
lychee = "latest"
1011

1112
[hooks]
1213
enter = "mise install --quiet"
@@ -22,3 +23,7 @@ run = "hugo --source docs --minify"
2223
[tasks.serve-docs]
2324
description = "Serve the docs site locally with Hugo dev server"
2425
run = "hugo server --source docs"
26+
27+
[tasks.check-links]
28+
description = "Check links with lychee"
29+
run = "lychee --no-progress './**/*.md' './src/**/*.php' './composer.json'"

src/Model/City.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Model class for the data returned by City Plus web service and City
1414
* database.
1515
*
16-
* See https://dev.maxmind.com/geoip/docs/web-services?lang=en for more
16+
* See https://dev.maxmind.com/geoip/docs/web-services/?lang=en for more
1717
* details.
1818
*/
1919
class City extends Country

src/Model/Country.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
/**
1414
* Model class for the data returned by GeoIP Country web service and database.
1515
*
16-
* See https://dev.maxmind.com/geoip/docs/web-services?lang=en for more details.
16+
* See https://dev.maxmind.com/geoip/docs/web-services/?lang=en for more details.
1717
*/
1818
class Country implements \JsonSerializable
1919
{

0 commit comments

Comments
 (0)