rarst / wporg-client
WordPress.org API 的 Guzzle 客户端
0.6
2022-06-20 08:42 UTC
Requires
- php: ^7.2.5 || ^8.0
- guzzlehttp/guzzle-services: ^1.3.2
README
WPorg Client 是一个独立的 HTTP 客户端,用于公共 WordPress.org API。
它旨在提供一致的中心化体验,并且独立于 WordPress 核心代码。
安装
composer require rarst/wporg-client
$wporgClient = \Rarst\Guzzle\WporgClient::getClient();
示例
核心
$updates = $wporgClient->getUpdates(); $updatesFor = $wporgClient->getUpdates('4.0', 'en_US'); $translations = $wporgClient->getTranslations('4.1'); $credits = $wporgClient->getCredits('4.1'); $checksums = $wporgClient->getChecksums('4.1', 'en_US');
主题
$theme = $wporgClient->getTheme('twentyfifteen'); $translations = $wporgClient->getThemeTranslations('twentyfifteen', '1.0'); $popular = $wporgClient->getThemesBy('browse', 'popular'); $featured = $wporgClient->getThemesBy('browse', 'featured'); $new = $wporgClient->getThemesBy('browse', 'new'); $updated = $wporgClient->getThemesBy('browse', 'updated'); $search = $wporgClient->getThemesBy('search', 'twenty'); $tagged = $wporgClient->getThemesBy('tag', 'white'); $authors = $wporgClient->getThemesBy('author', 'wordpressdotorg'); $featureList = $wporgClient->getThemeFeatureList();
插件
$plugin = $wporgClient->getPlugin('hello-dolly'); $stats = $wporgClient->getPluginStats('hello-dolly'); $downloads = $wporgClient->getPluginDownloads('hello-dolly', 7); $translations = $wporgClient->getPluginTranslations('akismet', '3.0'); $popular = $wporgClient->getPluginsBy('browse', 'popular'); $featured = $wporgClient->getPluginsBy('browse', 'featured'); $new = $wporgClient->getPluginsBy('browse', 'new'); $updated = $wporgClient->getPluginsBy('browse', 'updated'); $search = $wporgClient->getPluginsBy('search', 'dolly'); $tagged = $wporgClient->getPluginsBy('tag', 'widget'); $authors = $wporgClient->getPluginsBy('author', 'wordpressdotorg'); $importers = $wporgClient->getImporters(); $tags = $wporgClient->getHotTags();
活动
$location = $wporgClient->getEvents(['location' => 'Seattle'])); $number = $wporgClient->getEvents(['location' => 'Australia', 'number' => 5])); $locale = $wporgClient->getEvents(['timezone' => 'Europe/Berlin', 'locale' => 'de_DE', 'location' => 'Dresden'])); $coordinates = $wporgClient->getEvents(['latitude' => '51.051', 'longitude' => '13.738'])); $ip = $wporgClient->getEvents(['ip' => '136.0.16.1'])); $country = $wporgClient->getEvents(['country' => 'IT']));
其他
统计数据
$wordpress = $wporgClient->getStats('wordpress'); $php = $wporgClient->getStats('php'); $mysql = $wporgClient->getStats('mysql');
密钥和盐值
$secret = $wporgClient->getSalt();
浏览愉快
$browser = $wporgClient->getBrowser('Opera/9.80 (Windows NT 6.1; WOW64) Presto/2.12.388 Version/12.17');
许可证
MIT