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.
Question
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();
Solution
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.
OTHER TIPS
You can "use" it on the top of your php source file.
use Drewm\MailChimp;
$MailChimp = new MailChimp();