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();
有帮助吗?

解决方案

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.

其他提示

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

use Drewm\MailChimp;

$MailChimp = new MailChimp();
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top