Unable to use spatie/laravel-newsletter

Published 3 months ago by CraigDaviess

I'm looking to integrate Mailchimp into my application and allow my customers to subscribe for the mailing list. I came across the spatie/laravel-newsletter package which looked to be not only the perfection solution, but also extremely easy to implement (or so I thought).

  1. I used composer to require the package and also published the config file.
  2. I have a basic HTML form that passes information to my pages controller file.
  3. When I try to test the feature, I get a vendor related error:

"Type error: Return value of Spatie\Newsletter\NewsletterList::getId() must be of the type string, null returned"

It's complaining about a specific part in the following file:

\vendor\spatie\laravel-newsletter\src\NewsletterList.php

public function getId(): string { return $this->properties['id']; }

I've tried updating composer but there's nothing to update or install. The package is meant to have very little installation steps so I really have no idea where to go from here.

Hopefully someone can point me in the right direction? :)

Best Answer (As Selected By CraigDaviess)
CraigDaviess

Oh for the love of god.

Config file: 'id' => env('MAILCHIMP_LIST_ID'),

.env file: MAILCHIMP_LISTID=5b9cd49d8a

List_ID, not ListID.

CraigDaviess

Oh for the love of god.

Config file: 'id' => env('MAILCHIMP_LIST_ID'),

.env file: MAILCHIMP_LISTID=5b9cd49d8a

List_ID, not ListID.

Please sign in or create an account to participate in this conversation.