PHP library for generating importable Gmail filters in XML
Find a file
2016-12-05 01:10:21 +00:00
src/Opdavies/GmailFilterBuilder Rename and re-organise classes, add namespaces 2016-12-05 01:10:21 +00:00
templates Add twig-extensions and use TwigBooleanStringExtension 2016-07-15 02:52:31 +01:00
tests Added more tests 2016-10-12 23:11:31 +01:00
.editorconfig Initial commit 2016-07-12 20:54:44 +01:00
.gitignore Ignore XML files 2016-07-12 22:15:27 +01:00
composer.json Rename and re-organise classes, add namespaces 2016-12-05 01:10:21 +00:00
composer.lock Rename and re-organise classes, add namespaces 2016-12-05 01:10:21 +00:00
phpunit.xml Add phpunit.xml 2016-10-12 21:46:07 +01:00
README.md Update README 2016-09-30 13:03:42 +01:00

gmail-filter-builder

Description

Inspired by the gmail-britta Ruby library, the Gmail Filter Builder generates XML that can be imported into Gmails filter settings.

Usage

  • Run composer require opdavies/gmail-filter-builder to download the library.
  • Create a new PHP file and require autoload.php.
  • Create an array of GmailFilter objects, each with its required methods.
  • Pass the filters into an instance of GmailFilterBuilder.
require __DIR__ . '/vendor/autoload.php';

$filters = [];

// Add filters.
$filters[] = GmailFilter::create(
    ...
);

// Display the output.
new GmailFilterBuilder($filters);

To generate the output, run PHP on the file - e.g. php generate.php.

By default, the output is displayed on screen. To generate a file, use the greater than symbol followed by a file name - e.g. php generate.php > filters.xml.

Example

For a working example, see the opdavies/gmail-filters repository.

License

MIT