PHPackages                             fourlabs/gmail-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. fourlabs/gmail-bundle

ActiveLibrary

fourlabs/gmail-bundle
=====================

Gmail API Wrapper for Symfony

0.4.0(7y ago)41.8k[1 issues](https://github.com/fourlabsldn/GmailBundle/issues)1MITPHPPHP &gt;=7.1

Since Jan 30Pushed 6y ago1 watchersCompare

[ Source](https://github.com/fourlabsldn/GmailBundle)[ Packagist](https://packagist.org/packages/fourlabs/gmail-bundle)[ Docs](https://github.com/fourlabsldn/GmailBundle)[ RSS](/packages/fourlabs-gmail-bundle/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)Dependencies (11)Versions (5)Used By (1)

GmailBundle
===========

[](#gmailbundle)

[![StyleCI](https://camo.githubusercontent.com/3a68035e52dcb265a6e61d8559a4e03ebb188c6391bb742e2aff02cf98605b6c/68747470733a2f2f7374796c6563692e696f2f7265706f732f37303235313431302f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/70251410)[![SensioLabsInsight](https://camo.githubusercontent.com/253e67543ffcc4c144ca82769a30444858a806ca10e6df89cb16ac8954c98577/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f32313133666533642d383235362d343030392d386430632d3861383466323161376235392f6d696e692e706e67)](https://insight.sensiolabs.com/projects/2113fe3d-8256-4009-8d0c-8a84f21a7b59)

GmailBundle allows you to manage a Google Apps domain's inboxes (you can pick which). In order to do this, you must authorize a [service account with domain wide delegation](https://console.developers.google.com/iam-admin/serviceaccounts/serviceaccounts-zero)

Installation
------------

[](#installation)

```
    $ composer require fourlabs/gmail-bundle
```

Configuration
-------------

[](#configuration)

```
// app/config/config.yml
fl_gmail:
    admin_user_email: tech@slv.global
    json_key_location: /var/www/symfony/app/config/service_account_private_key.json
    gmail_message_class: \AppBundle\Entity\GmailMessage
    gmail_label_class: \AppBundle\Entity\GmailLabel
    gmail_history_class: \AppBundle\Entity\GmailHistory
    gmail_ids_class: \AppBundle\Entity\GmailIds

swiftmailer:
    default_mailer: general_mailer
    mailers:
        general_mailer:
            transport: "%mailer_transport%"
            host:      "%mailer_host%"
            username:  "%mailer_user%"
            password:  "%mailer_password%"
            spool:     { type: memory }
        fl_gmail_api_mailer:
            transport: fl_gmail.swift_transport
```

#### Syncing Gmail Ids (i.e. Which emails need to be synced?)

[](#syncing-gmail-ids-ie-which-emails-need-to-be-synced)

`FL\GmailBundle\Services\SyncGmailIds`

- Takes a `$userId` parameter.
- Gets a list of all the Gmail Ids, or the subset of Gmail Ids according to a history Id. [What is a history Id?](https://developers.google.com/gmail/api/guides/sync)
- Dispatches `FL\GmailBundle\Event\GmailSyncIdsEvent` with a list of all the new / updated ids. (Updated Gmail Ids = change of label)
- It is your responsibility to save the Gmail Ids coming from this event.
- Dispatches `FL\GmailBundle\Event\GmailSyncHistoryEvent`, such that next time, you can perform a Partial Sync. [What is a Partial Sync?](https://developers.google.com/gmail/api/guides/sync)
- It is your responsibility to save the History Id coming from this event.

#### Syncing Messages using Gmail Ids (i.e. I know which emails need to be synced, let's fetch them.)

[](#syncing-messages-using-gmail-ids-ie-i-know-which-emails-need-to-be-synced-lets-fetch-them)

`FL\GmailBundle\Services\SyncMessages`

- This service, takes a list of gmail ids and resolves all the new/updated messages for you.
- I.e. use the ids you are fetching from `FL\GmailBundle\Services\SyncGmailIds`
- Dispatches `FL\GmailBundle\Event\GmailSyncMessagesEvent`.
- It is your responsibility to save the Gmail Messages coming from this event.
- It is your responsibility to remove the newly synced Gmail Ids, you had previously saved with `FL\GmailBundle\Services\SyncGmailIds`.

#### All this responsibility? 😢 😭

[](#all-this-responsibility-cry-sob)

Why are there so many `It is your responsibility` statements? Because this bundle is storage agnostic. But don't fret! There is a [GmailDoctrineBundle](https://github.com/fourlabsldn/GmailDoctrineBundle) that implements all of this in Doctrine for you.

### How do I dive into this bundle?

[](#how-do-i-dive-into-this-bundle)

- Start by looking into the `Model` classes.
- To understand the services, have a look at `Resources/config/services.yml`.

### What else is going on?

[](#what-else-is-going-on)

- You can send swiftmailer emails through `FL\GmailBundle\Swift\GmailApiTransport`. Simply make sure the from is in your domain.
- `FL\GmailBundle\Form\Type\InboxType` contains a choice type, with all the inboxes in the authenticated domain.

License
-------

[](#license)

GmailBundle is licensed under the MIT license.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~182 days

Total

4

Last Release

2844d ago

PHP version history (2 changes)v0.1.0PHP &gt;=7.0

v0.2.0PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/d5ce21c0b03a3fd3a6767671cb39d44283389cbfbf91d492fd461119124c910a?d=identicon)[fourlabsldn](/maintainers/fourlabsldn)

---

Top Contributors

[![galeaspablo](https://avatars.githubusercontent.com/u/12404647?v=4)](https://github.com/galeaspablo "galeaspablo (102 commits)")[![jonny-no1](https://avatars.githubusercontent.com/u/282458?v=4)](https://github.com/jonny-no1 "jonny-no1 (10 commits)")

---

Tags

phpsymfonyGmail APIGmail Bundle

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/fourlabs-gmail-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/fourlabs-gmail-bundle/health.svg)](https://phpackages.com/packages/fourlabs-gmail-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
