Frage

I added this MailChimp API to Laravel 4 with Composer and I am able to use this API like so:

$MailChimp = new \Drewm\MailChimp();

How can I create an instance of MailChimp() without the path like this:

$MailChimp = new MailChimp();
War es hilfreich?

Lösung

You can manually add an alias to config/app.php:

'aliases' => array(
    //other laravel alias

    'MailChimp' => 'Drewm\MailChimp'
 );

Now you can use MailChimp anywhere in laravel app.

Andere Tipps

You can "use" it on the top of your php source file.

use Drewm\MailChimp;

$MailChimp = new MailChimp();
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top