hugofirth / laravel-mailchimp

A composer package for the MailChimp API PHP class (as provided by MailChimp) which supports the Laravel 4 framework.
96 stars 27 forks source link

Error When Attempting to Use the Wrapper #5

Closed garethdaine closed 10 years ago

garethdaine commented 10 years ago

I am getting this error when trying to use any of the API methods on MailchimpWrapper:

Using $this when not in object context

This happens when registering the service provider.

public function register()
{
    $this->app->singleton('mailchimp_wrapper',  function() {
        $mc = new Mailchimp($this->app['config']->get('mailchimp::apikey'));

        return new MailchimpWrapper($mc);
hugofirth commented 10 years ago

Hi garethdaine,

Thanks for submitting this issue. This issue is the same as that reported by the following pull request:

PR: https://github.com/hugofirth/laravel-mailchimp/pull/4

The issue lies in a pull request merged into master which updates the code in order to not rely on the Config facade.

PR: https://github.com/hugofirth/laravel-mailchimp/pull/2

The long and the short of it is that the recommended way of doing things seems to break in PHP 5.3.7

I haven't had a chance to decide what the best solution is so, thus far, I haven't released a tagged commit containing the change.

This means that you should only see this error if you're requiring dev-master in composer. I would strongly encourage you to, instead, do the following:

"require": {
    …
    "hugofirth/mailchimp": "2.0.*",
    … 
}

as per the instructions in the ReadMe. As a general rule of thumb, if a package provides semantic versioning you should depend on that for increased stability.

I will tag a patch release (which should automatically update on your end) when I have found out the best way to handle this (Knowing me, its probably something I'm missing)

Sorry for any inconvenience :)