A simple PHP scripting application which fetch emails from your Gmail account according to a filter and parses them for information.

Related tags

Markup gmail-parser
Overview

Gmail Parser

A simple PHP scripting application which fetch emails from your Gmail account according to a filter and parses them for information.

The application demonstrates this by parsing emails received for orders from amazon.com and amazon.co.uk.

Prerequisites

  1. 🐰 RabbitMQ message broker installed and running.
  2. 🧨 PHP 7.4+
  3. 🎼 composer
  4. A Google Cloud Platform project with the Gmail API enabled. To create a project and enable an API, refer to Create a project and enable the API

Install Composer Dependencies

composer install

This installs all dependencies required by the project.

Create a Google Cloud Platform Project with Gmail API Enabled

Refer to the docs and create a Google Cloud Platform project.

Enable the Gmail API.

Download the credentials.json file and put it inside /app/lib/. This file will be used in the OAuth flow to communicate with the Google Cloud Project.

Initiate OAuth Flow 🧦

composer auth

This runs a local web server in order to initiate the OAuth flow.

Navigate to localhost:8080 and authenticate with your Gmail account.

This will save auth information (access/refresh tokens) in a file called token.json under /app/lib.

You can change the port 8080 in composer.json file.

Run Email Fetcher 🚚

composer fetch

Runs a PHP script for fetching emails and pushing a relevant message to RabbitMQ broker.

After fetching, the script will exit.

Consider running this script as a CRON job.

Run Email Parser 🎪

composer parse

Runs a script which consumes messages from RabbitMQ broker and parses relevant information from messages like (item, price, date of purchase, store).

The script will listen to messages indefinitely (--timeout 0), unless it throws an error, or is stopped by a control signal (e.g. CTRL+C)

Enjoy! 😎

You might also like...
An HTML5 parser and serializer for PHP.

HTML5-PHP HTML5 is a standards-compliant HTML5 parser and writer written entirely in PHP. It is stable and used in many production websites, and has w

Advanced shortcode (BBCode) parser and engine for PHP

Shortcode Shortcode is a framework agnostic PHP library allowing to find, extract and process text fragments called "shortcodes" or "BBCodes". Example

UpToDocs scans a Markdown file for PHP code blocks, and executes each one in a separate process.

UpToDocs UpToDocs scans a Markdown file for PHP code blocks, and executes each one in a separate process. Include this in your CI workflows, to make s

HTML sanitizer, written in PHP, aiming to provide XSS-safe markup based on explicitly allowed tags, attributes and values.

TYPO3 HTML Sanitizer ℹ️ Common safe HTML tags & attributes as given in \TYPO3\HtmlSanitizer\Builder\CommonBuilder still might be adjusted, extended or

Efficient, easy-to-use, and fast PHP JSON stream parser

JSON Machine Very easy to use and memory efficient drop-in replacement for inefficient iteration of big JSON files or streams for PHP 5.6+. See TL;DR.

Parser for Markdown and Markdown Extra derived from the original Markdown.pl by John Gruber.

PHP Markdown PHP Markdown Lib 1.9.0 - 1 Dec 2019 by Michel Fortin https://michelf.ca/ based on Markdown by John Gruber https://daringfireball.net/ Int

Better Markdown Parser in PHP
Better Markdown Parser in PHP

Parsedown Better Markdown Parser in PHP - Demo. Features One File No Dependencies Super Fast Extensible GitHub flavored Tested in 5.3 to 7.3 Markdown

Convert HTML to Markdown with PHP

HTML To Markdown for PHP Library which converts HTML to Markdown for your sanity and convenience. Requires: PHP 7.2+ Lead Developer: @colinodell Origi

A super fast, highly extensible markdown parser for PHP

A super fast, highly extensible markdown parser for PHP What is this? A set of PHP classes, each representing a Markdown flavor, and a command line to

Owner
Haitham Sweilem
Haitham Sweilem
A simple class that converts your URLs to link names ✨

CuteLinkNames A simple class that converts your URLs to link names ✨ ??

♚ PH⑦ de Soria™♛ 5 Dec 9, 2022
📜 Modern Simple HTML DOM Parser for PHP

?? Simple Html Dom Parser for PHP A HTML DOM parser written in PHP - let you manipulate HTML in a very easy way! This is a fork of PHP Simple HTML DOM

Lars Moelleken 665 Jan 4, 2023
A simple PHP library for handling Emoji

Emoji Emoji images from unicode characters and names (i.e. :sunrise:). Built to work with Twemoji images. use HeyUpdate\Emoji\Emoji; use HeyUpdate\Emo

null 54 May 23, 2022
A simple PHP library for handling Emoji

Emoji Emoji images from unicode characters and names (i.e. :sunrise:). Built to work with Twemoji images. use HeyUpdate\Emoji\Emoji; use HeyUpdate\Emo

null 51 Jan 15, 2021
A simple Atom/RSS parsing library for PHP.

SimplePie SimplePie is a very fast and easy-to-use class, written in PHP, that puts the 'simple' back into 'really simple syndication'. Flexible enoug

SimplePie 1.5k Dec 18, 2022
This is a simple php project to help a friend how parse a xml file.

xml-parser-with-laravie Requirements PHP 7.4+ Composer 2+ How to to setup to test? This is very simple, just follow this commands git clone https://gi

Lucas Saraiva 2 Dec 3, 2021
php html parser,类似与PHP Simple HTML DOM Parser,但是比它快好几倍

HtmlParser php html解析工具,类似与PHP Simple HTML DOM Parser。 由于基于php模块dom,所以在解析html时的效率比 PHP Simple HTML DOM Parser 快好几倍。 注意:html代码必须是utf-8编码字符,如果不是请转成utf-8

俊杰jerry 522 Dec 29, 2022
Plug and play flat file markdown blog for your Laravel-projects

Ampersand Plug-and-play flat file markdown blog tool for your Laravel-project. Create an article or blog-section on your site without the hassle of se

Marcus Olsson 22 Dec 5, 2022
Simple URL parser

urlparser Simple URL parser This is a simple URL parser, which returns an array of results from url of kind /module/controller/param1:value/param2:val

null 1 Oct 29, 2021
This is a simple, streaming parser for processing large JSON documents

Streaming JSON parser for PHP This is a simple, streaming parser for processing large JSON documents. Use it for parsing very large JSON documents to

Salsify 687 Jan 4, 2023