Download the PHP package jub/craft-newsletter without Composer

On this page you can find all versions of the php package jub/craft-newsletter. 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 craft-newsletter

Newsletter Plugin for Craft CMS

Total Downloads Tests status

Newsletter for Craft CMS plugin makes it possible to let end users subscribe with various emailing services from a frontend form.

It currently supports the following services:

This plugin is GDPR compliant and requires the user to give its consent when subscribing to the newsletter.

💡 Similar to Craft Mailer adapters, you can even create your own adapter to connect to unsupported services.

Requirements

This plugin requires Craft CMS 4.0.0 or later and PHP 8.0.2 or later.

In order to support automatic Google reCAPTCHA verification, you will need to install jub/craft-google-recaptcha plugin.

Installation

  1. Install with composer via composer require jub/craft-newsletter from your project directory.
  2. Install the plugin in the Craft Control Panel under Settings → Plugins, or from the command line via ./craft install/plugin newsletter.

Configuration

Control Panel

You can manage configuration setting through the Control Panel by going to Settings → Newsletter

⚠️ When enabled, the Google reCAPTCHA feature will not render the frontend widget for you. You have to add {{ craft.googleRecaptcha.render() }} somewhere in the form view.

Service configuration

Mailjet settings

You can find these informations in your Mailjet account informations in the REST API keys section.

You can provide a contact list ID in order to subscribe the enduser to a specific one.

If no list ID is provided, user will only be created as a contact.

Brevo (ex Sendinblue) settings

You can find these informations in your Brevo account.

You can provide a contact list ID in order to subscribe the enduser to a specific one.

You can also enable Brevo Double Opt-in feature. You will need a Sendinblue template as described here.

If no list ID is provided, user will only be created as a contact.

Mailchimp settings

Configuration file

You can create a newsletter.php file in the config folder of your project and provide the settings as follow (example):

Depending on the service and its specific settings, adjust the adapterType to the according service adapter class name and provide required parameters in the adapterTypeSettings associative array (see Service configuration).

⚠️ Any value provided in that file will override the settings from the Control Panel.

Front-end form

You can use the following template as a starting point for your registration form:

The newsletter/newsletter/subscribe action expects the following inputs submitted as POST:

⚠️ Don’t forget to add {{ craft.googleRecaptcha.render() }} in the form view if the Google reCAPTCHA verification is enabled.

XHR / AJAX form

Alternatively, you can submit the newsletter form with Javascript.
This gives you more freedom to provide visual effects to the user and prevents the page from reloading and scrolling to the top of the page.
The downside is that you need to write the ajax-request.
Use the example below as a reference, note the required application/json header:

⚠️ If the Google reCAPTCHA verification is enabled, add the data.append("g-recaptcha-response", ""); to the request as well!

Custom validations

You can provide your own validations on frontend form submission in a project module or a plugin using the afterValidate event on the NewsletterForm model:

How to create an adapter

To add a new adapter for unsupported services:

Create an adapter class that extends the juban\newsletter\adapters\BaseNewsletterAdapter class.

Some small example:

The template settings view could look like this:

The adapter model can be accessed in the twig view using the adapter variable.

Last, in a module or a plugin, register the adapter as follow:

Roadmap


Base plugin icon makes use of Font Awesome Free


All versions of craft-newsletter with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0.2
craftcms/cms Version ^4.0
mailjet/mailjet-apiv3-php Version ^1.5
mailchimp/marketing Version ^3.0
getbrevo/brevo-php Version ^1.0
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 jub/craft-newsletter contains the following files

Loading the files please wait ....