gmail-filter-builder/README.md

39 lines
1.1 KiB
Markdown
Raw Normal View History

2016-07-12 20:30:30 +00:00
# gmail-filter-builder
## Description
Inspired by the [gmail-britta](https://github.com/antifuchs/gmail-britta) Ruby library, the Gmail Filter Builder generates XML that can be imported into Gmails filter settings.
## Usage
2016-07-15 00:37:30 +00:00
* 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`.
```php
require __DIR__ . '/vendor/autoload.php';
$filters = [];
// Add filters.
2016-09-30 12:03:42 +00:00
$filters[] = GmailFilter::create(
...
);
2016-07-15 00:37:30 +00:00
// Display the output.
2016-09-30 12:03:42 +00:00
new GmailFilterBuilder($filters);
2016-07-15 00:37:30 +00:00
```
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](https://github.com/opdavies/gmail-filters/blob/master/generate.php) repository.
2016-07-12 20:30:30 +00:00
## License
MIT