danjones000/php-notmuch

用于访问 notmuch 邮件库的 PHP 库

v0.0.3 2021-05-21 21:28 UTC

This package is auto-updated.

Last update: 2024-09-22 10:19:48 UTC


README

此库可以用作访问您的 notmuch 数据库 的 API。

这是一个非常早期的版本。它可能有很多错误。您真的不应该现在使用它。

安装

使用以下方式安装

composer require danjones000/php-notmuch

但是,您可能不想现在使用它。您会收到很多 BadMethodCallException

用法

use Danjones\Notmuch\Notmuch;

$notmuch = new Notmuch();
// or, to specify path to notmuch command
$notmuch = new Notmuch('/path/to/notmuch.sh');
// notmuch command must be in your PATH, or an absolute path.

$notmuch->new(); // Fetches new files into database
$notmuch->search(['tag:inbox', 'AND', 'tag:unread']); // Returns an array of messages.
$notmuch->tag(['-unread'], ['tag:unread']); // Untag all unread messages as unread
// ...

API 与 CLI 用法紧密匹配。

未来开发计划。

未来,将添加更面向对象的方法。我希望能够做类似的事情

$messages = $notmuch->search(['tag:inbox']); // $messages will be a MessageCollection
$messages->tag(['+newtag']);
$first = $messages->first(); // $first will be a Message object
$first->tag(['+anothertag']);

开发

欢迎 合并请求

代码应遵循 PSR-12 标准。