Download the PHP package partridgerocks/gmail-client without Composer

On this page you can find all versions of the php package partridgerocks/gmail-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package gmail-client

Laravel Gmail Client

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads PHP Version Support Laravel Version Support

A Laravel package that integrates with the Gmail API to seamlessly manage emails within your application. Built with Saloon PHP for API interactions and Laravel Data for structured data handling.

๐Ÿ“‹ Table of Contents

๐Ÿš€ Features

๐Ÿ“‹ Requirements

๐Ÿ“ฆ Installation

You can install the package via Composer:

After installation, publish the configuration file:

This will create a config/gmail-client.php configuration file in your project.

๐Ÿ” Google API Setup

Before you can use the Gmail Client, you need to set up a project in the Google Developer Console and obtain OAuth 2.0 credentials:

  1. Go to the Google Developer Console
  2. Create a new project (or select an existing one)
  3. Navigate to "APIs & Services" > "Library"
  4. Search for and enable the "Gmail API"
  5. Go to "APIs & Services" > "Credentials"
  6. Click "Configure Consent Screen" and set up your OAuth consent screen:
    • Select "External" or "Internal" user type (depending on your needs)
    • Fill in the required app information
    • Add the required scopes (see below)
    • Add test users if needed (for external user type)
  7. Create OAuth 2.0 credentials:
    • Go to "Credentials" and click "Create Credentials" > "OAuth client ID"
    • Select "Web application" as the application type
    • Add a name for your client
    • Add your authorized redirect URIs (this should match your GMAIL_REDIRECT_URI config value)
    • Click "Create"
  8. Copy the Client ID and Client Secret to your .env file:

Note: The Gmail API requires specific scopes to access different features. The default configuration includes commonly used scopes, but you can customize them in the config file.

๐Ÿ” Usage

The package automatically registers a Laravel Facade that provides a convenient way to interact with the Gmail API:

Authentication

The Gmail Client provides two ways to authenticate with the Gmail API:

1. Manual Authentication Flow

If you want full control over the authentication process:

2. Using Built-in Routes

For a simpler setup, you can enable the built-in routes:

  1. Enable route registration in the config file:

  2. Use the provided routes in your app:

The package will handle the OAuth flow and store the tokens in the session by default.

Working with Emails

Once authenticated, you can use the client to interact with Gmail:

List Messages

Get a Specific Message

Send an Email

Working with Labels

Gmail uses labels to organize emails. You can create, retrieve, and manage these labels:

Using Without Facade

If you prefer not to use the facade, you can resolve the client from the container:

Integration with Your User Model

Here's an example of how you might integrate the Gmail client with your User model:

๐Ÿ”ง Advanced Usage

Pagination Support

The package supports pagination for listing messages and labels:

Memory Efficiency

When working with large Gmail accounts, it's important to avoid loading all messages into memory at once:

Enhanced Error Handling

The package provides detailed error handling for common Gmail API errors:

Refresh a Token

Command Line Testing

The package includes a command to test your Gmail API connection:

Custom Email Templates

You can use your own branded email templates:

๐Ÿ“ก Events

The package dispatches events that you can listen for:

๐Ÿงช Testing

The package includes tests that you can run with PHPUnit:

For testing in your own application, you can use Saloon's built-in mocking capabilities:

๐Ÿ“ Changelog

Please see CHANGELOG for more information on what has changed recently.

๐Ÿค Contributing

Please see CONTRIBUTING for details.

๐Ÿ”’ Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

๐Ÿ‘จโ€๐Ÿ’ป Credits

๐Ÿ“„ License

The MIT License (MIT). Please see License File for more information.


All versions of gmail-client with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/contracts Version ^10.0||^11.0||^12.0
saloonphp/saloon Version ^3.0
spatie/laravel-data Version ^4.15
spatie/laravel-package-tools Version ^1.16
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package partridgerocks/gmail-client contains the following files

Loading the files please wait ....