From 5c74cb51d13ec98347964b66165e69b8335a5435 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 15 Jul 2016 01:37:30 +0100 Subject: [PATCH] Add usage instructions Fixes #2 --- README.md | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 61e84b3..508a193 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,33 @@ Inspired by the [gmail-britta](https://github.com/antifuchs/gmail-britta) Ruby l ## Usage -TODO +* 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 it’s required methods. +* Pass the filters into an instance of `GmailFilterBuilder`. + +```php +require __DIR__ . '/vendor/autoload.php'; + +$filters = []; + +// Add filters. +$filters[] = GmailFilter::create(); + +... + +// Display the output. +print 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](https://github.com/opdavies/gmail-filters/blob/master/generate.php) repository. ## License MIT -