https://github.com/scullwm/inboxsearch
Search operators library for your project like Gmail search
https://github.com/scullwm/inboxsearch
filter gmail-inbox search-engine search-operator searching searching-algorithms searchquery
Last synced: 3 months ago
JSON representation
Search operators library for your project like Gmail search
- Host: GitHub
- URL: https://github.com/scullwm/inboxsearch
- Owner: ScullWM
- Created: 2016-03-16T21:18:10.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-09-30T06:58:40.000Z (about 9 years ago)
- Last Synced: 2025-05-30T16:37:04.768Z (4 months ago)
- Topics: filter, gmail-inbox, search-engine, search-operator, searching, searching-algorithms, searchquery
- Language: PHP
- Homepage:
- Size: 22.5 KB
- Stars: 10
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
InboxSearch
===========
Search operators library.
See more from Gmail: https://support.google.com/mail/answer/7190?hl=en## Supported operators
- Filename (string)
- Size (integer - convert string in bytes)
- Has (string)
- From (string)
- To (string)
- Subject (string)
- Label (string)
- Delivered To (string)
- After (\DateTime)
- Before (\DateTime)
- Older (\DateTime)
- Newer (\DateTime)
- In (string)## How to use
```php
$term = 'from:thomas@scullwm.com forum';
$factory = new InboxSearchFactory($term);// return InboxSearchInterface
$inboxSearch = $factory->process();$from = $inboxSearch->getFrom(); // thomas@scullwm.com
$keyword = $inboxSearch->getKeyword(); // array('from' => 'forum')$fromKeyword = $inboxSearch->getKeywordFor(InboxSearchInterface::FILTER_FROM); // forum
```## Create your own filter
Filter must implement `FilterInterface`.
Then register the filter in your factory instance
```php$factory = new InboxSearchFactory($term);
$myFilterParserFqcn = 'Swm\InboxSearch\FilterModel\MyCustomFilter';
$factory->addFilterParser($myFilterParserFqcn);```
## Tests
```shell
php composer install --dev
bin/atoum -d tests/units
```