Download the PHP package aslamhus/sendgrid-email-wrapper without Composer
On this page you can find all versions of the php package aslamhus/sendgrid-email-wrapper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download aslamhus/sendgrid-email-wrapper
More information about aslamhus/sendgrid-email-wrapper
Files in aslamhus/sendgrid-email-wrapper
Package sendgrid-email-wrapper
Short Description a fluent interface for the SendGrid API v3, providing methods for constructing and sending emails with features such as dynamic template data, attachments, and various content types
License MIT
Informations about the package sendgrid-email-wrapper
Aslamhus\Email PHP Class
Overview
This PHP Library, Aslamhus/Email, is convenient and flexible wrapper for interacting with the SendGrid API v3.0.0. It is designed to provide a fluent interface for sending emails via SendGrid, making it simple to integrate email functionality into your PHP projects. The class includes methods for composing and sending emails with features such as dynamic template data, attachments, and more.
Installation / Setup
To use this class in your project, follow these steps:
-
Create an account with Sendgrid.
-
Create an API Key in your new sendgrid account. In the sidebar of your dashboard, choose
EmailApi, then selectIntegration Guidefrom the dropdown. Choose WebApi -> Php, then create your api key. You do not need to install sendgrid through composer, installing this class will do that for you. The last step in the integration guide is to send a verification email. Before we do that, install the library. - Create a single sender identity.
This will allow you to send emails from an authenticated email. In the sidebar choose
Sender Authentication, thenVerify a Single Sender. Follow the steps. You'll use this email in thefrommethod when sending emails. -
Install
Aslamhus/Email -
Send verficiation email (optional)
- Confirm verification.
Go back to the integration guide in your Sendgrid account, and at the bottom of the page choose
Verify Integration. You should get a confirmation that your integration was successful.
Usage
Send basic email
Send Email with dynamic template data
Dynamic template data variables can be set using handlebars {{my_var}}.
For more info see https://docs.sendgrid.com/for-developers/sending-email/using-handlebars
Additional Features
-
Add Attachments:
-
Add Content:
- Get email response:
Resources
Issues and Contributions
If you encounter any issues or would like to contribute to the development of this class, please visit the GitHub repository: Aslamhus\Email.
Testing
To run tests on this library, follow these steps:
- Set your sample.env file with the require fields, then rename sample.env to .env
- Run tests
License
This class is open-source and released under the MIT License. Feel free to use, modify, and distribute it according to your project's needs.