nemorize/indexnow
最新稳定版本:0.0.1
Composer 安装命令:
composer require nemorize/indexnow
包简介
PHP library for submitting website URLs using IndexNow to search engines.
README 文档
README
php-indexnow is a PHP library for IndexNow API.
Example usage
composer require nemorize/indexnow
$indexnow = new \Nemorize\Indexnow\Indexnow(); $indexnow->setKey('fc1e3ad82010475381daf9846e627fdd'); $indexnow->submit('https://example.com/url-changed'); $indexnow->submit([ 'https://example.com/url-changed', 'https://example.com/url-changed-2' ]);
Specification
setHost
Indexnow::setHost (string $host): void;
You can change the hostname of the API. If you don't set the hostname, the default host is api.indexnow.org.
getHost
Indexnow::getHost (): string;
Returns the hostname of the API.
setKey
Indexnow::setKey (string $key): void;
You can change the key of the API.
getKey
Indexnow::getKey (): string;
Returns the key of the API.
setKeyLocation
Indexnow::setKeyLocation (?string $keyLocation): void;
You can change the key location of the API. If you want to unset the key location, you can set null.
getKeyLocation
Indexnow::getKeyLocation (): ?string;
Returns the key location of the API.
submit
Indexnow::submit (string|array $url, array $guzzleOptions = null): void;
You can submit a URL to the API. If you use $url as an array, it will submit multiple URLs using JSON request.
$guzzleOptions is an array of options for Guzzle.
Exceptions
submit method throws exceptions if some errors occur.
If the API throws well-known non-20x response codes, it will throw the following exceptions that extend IndexnowException.
Any other errors will throw GuzzleException.
BadRequestExceptionForbiddenExceptionTooManyRequestsExceptionUnprocessableEntityException
License
MIT License
统计信息
- 总下载量: 2.59k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-07-31