PHPackages                             protonlabs/libsieve-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. protonlabs/libsieve-php

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

protonlabs/libsieve-php
=======================

libsieve-php is a library to manage and modify sieve (RFC5228) scripts.

v3.0.0(4y ago)2375.0k↓33.3%8[6 issues](https://github.com/ProtonMail/libsieve-php/issues)GPL-3.0-or-laterPHPPHP &gt;=8.0CI passing

Since Aug 11Pushed 1y ago21 watchersCompare

[ Source](https://github.com/ProtonMail/libsieve-php)[ Packagist](https://packagist.org/packages/protonlabs/libsieve-php)[ Docs](https://sourceforge.net/projects/libsieve-php/)[ RSS](/packages/protonlabs-libsieve-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (4)Versions (9)Used By (0)

libsieve-php
============

[](#libsieve-php)

[![Build Status](https://camo.githubusercontent.com/8f53bb652f0f84ded0238b79c254f86a404fdab56b59a0899257110a785bc24e/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f50726f746f6e4d61696c2f6c696273696576652d7068702e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/ProtonMail/libsieve-php)[![Coverage](https://camo.githubusercontent.com/05e2163003a8b1e8558b1f17ac6f16341484888d229260d58e2ed154203e0fba/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f50726f746f6e4d61696c2f6c696273696576652d7068702e7376673f7374796c653d666c61742d737175617265)](https://codecov.io/gh/ProtonMail/libsieve-php)[![License](https://camo.githubusercontent.com/bea21f01f29c0027d3dc9f3ed457c7637c53814a4e3c3ba67337a980421da299/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f50726f746f6e4d61696c2f6c696273696576652d7068702e7376673f7374796c653d666c61742d737175617265)](https://github.com/ProtonMail/libsieve-php/blob/master/LICENSE)

libsieve-php is a library to manage and modify sieve (RFC5228) scripts. It contains a parser for the sieve language (including extensions).

This project is adopted from the discontinued PHP sieve library available at .

Changes from the RFC
--------------------

[](#changes-from-the-rfc)

- The `date` and the `currentdate` both allow for `zone` parameter any string to be passed. This allows the user to enter zone names like `Europe/Zurich` instead of `+0100`. The reason we allow this is because offsets like `+0100` don't encode information about the daylight saving time, which is often needed.

Usage examples
--------------

[](#usage-examples)

The libsieve parses a sieve script into a tree. This tree can then be used to interpret its meaning.

Two example will be provided: one basic and one more complex.

### Basic Example: Check if an extension is loaded

[](#basic-example-check-if-an-extension-is-loaded)

In this first example, we will check if a specific extension was loaded through a require node:

```
