承接 nemorize/indexnow 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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.

  • BadRequestException
  • ForbiddenException
  • TooManyRequestsException
  • UnprocessableEntityException

License

MIT License

统计信息

  • 总下载量: 2.59k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-07-31