Skip to content

Commit 0a60b48

Browse files
authored
Merge pull request #265 from maxmind/greg/stf-557
Validate and update links (STF-557)
2 parents 5dbf217 + 0679b0e commit 0a60b48

9 files changed

Lines changed: 143 additions & 18 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
@@ -19,3 +19,4 @@ vendor/
1919
*.iml
2020
*.sw?
2121
*.old
22+
.lycheecache

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,5 +397,5 @@ vendor/bin/phpunit
397397

398398
- [API Documentation](https://maxmind.github.io/minfraud-api-php/)
399399
- [minFraud Web Services Docs](https://dev.maxmind.com/minfraud/)
400-
- [Report Transaction API Docs](https://dev.maxmind.com/minfraud/report-transaction/)
400+
- [Report Transaction API Docs](https://dev.maxmind.com/minfraud/report-a-transaction/)
401401
- GitHub Issues: https://github.com/maxmind/minfraud-api-php/issues

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ require 'vendor/autoload.php';
4444
## Install via Phar
4545

4646
Although we strongly recommend using Composer, we also provide a
47-
[phar archive](https://php.net/manual/en/book.phar.php) containing most of the
47+
[phar archive](https://www.php.net/manual/en/book.phar.php) containing most of the
4848
dependencies for this API. The latest phar archive is available on
4949
[our releases page](https://github.com/maxmind/minfraud-api-php/releases).
5050

5151
### Install Dependencies
5252

5353
Please note that you must have the PHP
54-
[cURL extension](https://php.net/manual/en/book.curl.php) installed to use
54+
[cURL extension](https://www.php.net/manual/en/book.curl.php) installed to use
5555
this archive. For Debian based distributions, this can typically be found in
5656
the `php-curl` package. For other operating systems, please consult the
5757
relevant documentation. After installing the extension you may need to restart
@@ -81,7 +81,7 @@ tab.
8181

8282
This library provides access to both the
8383
[minFraud (Score, Insights and Factors)](https://dev.maxmind.com/minfraud/)
84-
and [Report Transaction](https://dev.maxmind.com/minfraud/report-transaction/)
84+
and [Report Transaction](https://dev.maxmind.com/minfraud/report-a-transaction/)
8585
APIs.
8686

8787
### minFraud API
@@ -336,7 +336,7 @@ Please report all issues with this code using the
336336

337337
If you are having an issue with the minFraud service that is not specific to
338338
the client API, please see
339-
[our support page](https://www.maxmind.com/en/support).
339+
[our support page](https://support.maxmind.com/knowledge-base).
340340

341341
## Requirements
342342

lychee.toml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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+
# The minFraud API responses doc renders its schema anchors client-side, so
35+
# lychee cannot verify the #fragment even though the page and anchor exist.
36+
'^https://dev\.maxmind\.com/minfraud/api-documentation/responses/#',
37+
# Placeholders / local
38+
'^https?://example\.(com|org|net)',
39+
'^http://localhost',
40+
'127\.0\.0\.1',
41+
]
42+
43+
# Exclude file paths from getting checked (treated as regular expressions)
44+
exclude_path = [
45+
'(^|/)node_modules/',
46+
'(^|/)vendor/',
47+
# Generated Hugo docs site committed under docs/public
48+
'(^|/)docs/public/',
49+
'(^|/)\.git/',
50+
# Changelog: historical entries are preserved as-is, not rewritten
51+
'(^|/)CHANGELOG\.md$',
52+
]
53+
54+
# Cache results for 1 day to speed up repeated checks
55+
cache = true
56+
max_cache_age = "1d"
57+
58+
# Skip missing input files instead of erroring
59+
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/MinFraud.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function jsonSerialize(): array
114114
* This returns a `MinFraud` object with the array to be sent to the web
115115
* service set to `$values`. Existing values will be replaced.
116116
*
117-
* @link https://dev.maxmind.com/minfraud/api-documentation?lang=en
117+
* @link https://dev.maxmind.com/minfraud/api-documentation/?lang=en
118118
* minFraud API docs
119119
*
120120
* @param array<string, mixed> $values The request as a structured array
@@ -197,7 +197,7 @@ public function with(array $values): self
197197
* @return MinFraud A new immutable MinFraud object. This object is a clone
198198
* of the original with additional data.
199199
*
200-
* @link https://dev.maxmind.com/minfraud/api-documentation/requests?lang=en#schema--request--device
200+
* @link https://dev.maxmind.com/minfraud/api-documentation/requests/?lang=en#schema--request--device
201201
* minFraud device API docs
202202
*/
203203
public function withDevice(
@@ -324,7 +324,7 @@ public function withDevice(
324324
* @return MinFraud A new immutable MinFraud object. This object is a clone of
325325
* the original with additional data.
326326
*
327-
* @link https://dev.maxmind.com/minfraud/api-documentation/requests?lang=en#schema--request--event
327+
* @link https://dev.maxmind.com/minfraud/api-documentation/requests/?lang=en#schema--request--event
328328
* minFraud event API docs
329329
*/
330330
public function withEvent(
@@ -405,7 +405,7 @@ public function withEvent(
405405
* This returns a `MinFraud` object with the `account` array set to
406406
* the values provided. Existing `` data will be replaced.
407407
*
408-
* @link https://dev.maxmind.com/minfraud/api-documentation/requests?lang=en#schema--request--account
408+
* @link https://dev.maxmind.com/minfraud/api-documentation/requests/?lang=en#schema--request--account
409409
* minFraud account API docs
410410
*
411411
* @param array<string, mixed> $values An array of account data. The keys are the same as
@@ -458,7 +458,7 @@ public function withAccount(
458458
* This returns a `MinFraud` object with the `email` array set to
459459
* values provided. Existing `email` data will be replaced.
460460
*
461-
* @link https://dev.maxmind.com/minfraud/api-documentation/requests?lang=en#schema--request--email
461+
* @link https://dev.maxmind.com/minfraud/api-documentation/requests/?lang=en#schema--request--email
462462
* minFraud email API docs
463463
*
464464
* @param array<string, mixed> $values An array of email data. The keys are the same as
@@ -519,7 +519,7 @@ public function withEmail(
519519
* This returns a `MinFraud` object with the `billing` array set to
520520
* `$values`. Existing `billing` data will be replaced.
521521
*
522-
* @link https://dev.maxmind.com/minfraud/api-documentation/requests?lang=en#schema--request--billing
522+
* @link https://dev.maxmind.com/minfraud/api-documentation/requests/?lang=en#schema--request--billing
523523
* minFraud billing API docs
524524
*
525525
* @param array<string, mixed> $values An array of billing data. The keys are the same as
@@ -646,7 +646,7 @@ public function withBilling(
646646
* This returns a `MinFraud` object with the `shipping` array set to
647647
* the values provided. Existing `shipping` data will be replaced.
648648
*
649-
* @link https://dev.maxmind.com/minfraud/api-documentation/requests?lang=en#schema--request--shipping
649+
* @link https://dev.maxmind.com/minfraud/api-documentation/requests/?lang=en#schema--request--shipping
650650
* minFraud shipping API docs
651651
*
652652
* @param array<string, mixed> $values An array of shipping data. The keys are the same as
@@ -768,7 +768,7 @@ public function withShipping(
768768
* This returns a `MinFraud` object with the `payment` array set to
769769
* the values provided. Existing `payment` data will be replaced.
770770
*
771-
* @link https://dev.maxmind.com/minfraud/api-documentation/requests?lang=en#schema--request--payment
771+
* @link https://dev.maxmind.com/minfraud/api-documentation/requests/?lang=en#schema--request--payment
772772
* minFraud payment API docs
773773
*
774774
* @param array<string, mixed> $values An array of payment data. The keys are the same as
@@ -1027,7 +1027,7 @@ public function withPayment(
10271027
* This returns a `MinFraud` object with the `credit_card` array set to
10281028
* provided values. Existing `credit_card` data will be replaced.
10291029
*
1030-
* @link https://dev.maxmind.com/minfraud/api-documentation/requests?lang=en#schema--request--credit-card
1030+
* @link https://dev.maxmind.com/minfraud/api-documentation/requests/?lang=en#schema--request--credit-card
10311031
* minFraud credit_card API docs
10321032
*
10331033
* @param array<string, mixed> $values An array of credit card data. The keys are the same as
@@ -1225,7 +1225,7 @@ public function withCustomInputs(array $values): self
12251225
* This returns a `MinFraud` object with the `order` array set to
12261226
* the provided values. Existing `order` data will be replaced.
12271227
*
1228-
* @link https://dev.maxmind.com/minfraud/api-documentation/requests?lang=en#schema--request--order
1228+
* @link https://dev.maxmind.com/minfraud/api-documentation/requests/?lang=en#schema--request--order
12291229
* minFraud order API docs
12301230
*
12311231
* @param array<string, mixed> $values An array of order data. The keys are the same as the JSON keys.
@@ -1243,7 +1243,7 @@ public function withCustomInputs(array $values): self
12431243
*
12441244
* @return MinFraud A new immutable MinFraud object. This object is a clone of the original with additional data.
12451245
*
1246-
* @see https://support.maxmind.com/hc/en-us/articles/5452293435675-Order-and-Shopping-Cart-Inputs#h_01G0Z50Q0MRXQ5R52EF34E6G7J
1246+
* @see https://support.maxmind.com/knowledge-base/articles/order-and-shopping-cart-inputs-minfraud
12471247
*/
12481248
public function withOrder(
12491249
array $values = [],
@@ -1326,7 +1326,7 @@ public function withOrder(
13261326
* This returns a `MinFraud` object with the provided values added to the
13271327
* shopping cart array. Existing shopping cart data will be preserved.
13281328
*
1329-
* @link https://dev.maxmind.com/minfraud/api-documentation/requests?lang=en#schema--request--shopping-cart--item
1329+
* @link https://dev.maxmind.com/minfraud/api-documentation/requests/?lang=en#schema--request--shopping-cart
13301330
* minFraud shopping cart item API docs
13311331
*
13321332
* @param array<string, mixed> $values An array of shopping cart data. The keys are the same

src/MinFraud/Model/Device.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* In order to receive device output from minFraud Insights or minFraud
1111
* Factors, you must be using the Device Tracking Add-on.
1212
*
13-
* @link https://dev.maxmind.com/minfraud/track-devices?lang=en Device Tracking
13+
* @link https://dev.maxmind.com/minfraud/track-devices/?lang=en Device Tracking
1414
* Add-on
1515
*/
1616
class Device implements \JsonSerializable

0 commit comments

Comments
 (0)