chipslays / pastly-api
Pastly API 的 PHP 客户端。
1.1.1
2021-06-07 08:59 UTC
Requires
- chipslays/collection: ^1.0
- guzzlehttp/guzzle: ^7.3
Requires (Dev)
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-09-26 12:44:52 UTC
README
为 Pastly API 提供简单的客户端实现。
Pastly - 互联网上最性感的代码粘贴板。
安装
composer require chipslays/pastly-api
用法
use Pastly\Client; require 'vendor/autoload.php'; $client = new Client; $token = '1622233044:6bCVU-8OI9fjtk3gXhZRJkzQeDGsJNKti2MuBM_n9V'; /** get paste */ $paste = $client->get('example-slug'); $paste = pastly_get('example-slug'); echo $paste->getText(); /** create paste */ $client->create($token, 'Hello, world!'); pastly_create($token, 'Hello, world!'); /** edit paste */ $client->edit($token, 'example-slug', [ 'title' => 'New Title', 'syntax' => 'diff', 'text' => "this text\n-was edited\n+successful", ]); pastly_edit($token, 'example-slug', [ 'title' => 'New Title', 'syntax' => 'diff', 'text' => "this text\n-was edited\n+successful", ]);
更多代码示例可以在 examples 文件夹中查看。
示例
示例代码可以在 这里 找到。
测试
composer test
致谢
许可证
MIT 许可证(MIT)。有关更多信息,请参阅 许可证文件。