koh/indexnow — notifying search engines, without a framework.
A new link waits until a crawler happens to come by. With IndexNow you tell search engines yourself which URL is new, changed or removed. Bing, Yandex, Seznam, Naver, Yep and Amazon share every submission. Bing's index feeds ChatGPT search and Copilot.
- Composer package:
koh/indexnow - Integrations:typo3-indexnow and sylius-indexnow
- PHP: 8.3+ · MIT · source on GitHub
TL;DR — Does this fit my setup?
Use it if
- you want to build IndexNow into your own PHP application
- you run a framework without a ready-made integration
- test systems must never submit anything
Do not use it if
- you run TYPO3 or Sylius: ready-made packages exist that include this one
- you want to reach Google, which does not take part in IndexNow
- you run PHP < 8.3
Effort
One Composer package, one PSR-18 client, three lines of code. No configuration file, no global state.
What the package takes care of
| Task | How |
|---|---|
| Keys | Key::derive() computes a stable per-host key from an application secret (HMAC-SHA256). Nothing to store, identical on every replica, different for every host. |
| Hosts that are never announced | HostPolicy refuses IP addresses, single-label names, .localhost, .test, .invalid, .internal, .local and hosts with dev, staging or preview. The check runs inside the client, before any network access. |
| Valid submissions | Same host, http and https only, no credentials, no fragments. Duplicates are removed, lists over 10,000 URLs are split. |
| Outcomes a queue can act on | Every response becomes an Outcome with isRetryable(): 429, 5xx, transport errors and 403 are retryable, 400 and 422 are not. Retry-After is parsed and capped. |
| No leaks | The key appears neither in exception messages nor in log excerpts. |
Usage
use Koh\IndexNow\IndexNowClient;
use Koh\IndexNow\Key;
use Koh\IndexNow\Submission;
$key = Key::derive($applicationSecret, 'www.example.org');
// Serve $key->value as text/plain at www.example.org/{$key->fileName()}
$client = new IndexNowClient($psr18Client, $psr17RequestFactory, $psr17StreamFactory);
$submission = Submission::forHost('www.example.org', $key, [
'https://www.example.org/news/launch',
]);
foreach ($client->submitAll($submission) as $result) {
if ($result->isRetryable()) {
// queue again, after $result->retryAfterSeconds if the engine said so
}
}
Give your PSR-18 client a short timeout of five to ten seconds and do not let it follow redirects: the request body carries the key.
The default endpoint is api.indexnow.org/indexnow. Other endpoints must use HTTPS and belong to a known participant. That guards against a typo in the configuration sending the key to someone else's domain.
Limits
- Google does not take part. For Google, the sitemap and Search Console remain.
- IndexNow is a hint, not a guarantee: whether and when a URL is indexed is the engine's decision.
- An announced URL cannot be recalled. That is why the client checks the host before anything goes out.
- The package is an independent implementation written from the IndexNow specification and is not affiliated with any participant.
Bring IndexNow into your application?
If new URLs take days before Bing and the AI search engines know them, koh/indexnow helps. Talk to me about the integration or monitoring the submissions.
Or email me directly: mail@ole-hartwig.eu