macroman / nitropack-api
此包已被弃用,不再维护。没有建议的替代包。
Nitropack的非官方API适配器
0.0.2
2021-07-30 12:25 UTC
Requires
- php: >=7.3|>=8.0
This package is auto-updated.
Last update: 2023-12-29 03:40:13 UTC
README
此存储库主要基于 https://nitropack.io/download/plugin/nitropack-php-sdk-limited-support,对某些部分进行了整理和重构,以便允许使用composer安装。
安装
composer require macroman/nitropack-api
使用方法
use NitroPack\NitroPack;
use NitroPack\PurgeType;
// Initialize API
$nitro = new NitroPack('site_id', 'secret');
// Clear entire cache
$nitro->purgeCache();
// Clear specific URL
$nitro->purgeCache('https://example.com/');
// Clear tagged pages
$nitro->purgeCache(null, 'tag-name');
// Clear cache leaving a reason (shows in WordPress settings page)
$nitro->purgeCache(null, null, PurgeType::COMPLETE, 'This is my reason');
// Add a tag to a URL
$nitro->tagUrl('https://example.com/', 'tag-name');
// Enable/disable compression
$nitro->enableCompression();
$nitro->disableCompression();
更多功能可用,但未记录文档。查看 NitroPack\NitroPack.php
获取更多信息。