Laravel Mailcoach API is a package to make it easier to integrate your own Mailcoach API for your other Laravel projects.
Refer to this docs
You can install the package via composer:
composer require kevinpurwito/laravel-mailcoach-api
The vendor:publish
command will publish a file named kp_mailcoach.php
within your laravel project config
folder config/kp_mailcoach.php
.
Published Config File Contents
[
'url' => strtolower(env('KP_MAILCOACH_API_URL')),
'token' => env('KP_MAILCOACH_API_TOKEN'),
'list_id' => intval(env('KP_MAILCOACH_LIST_ID', 1)),
];
Alternatively you can ignore the above publish command and add this following variables to your .env
file.
KP_MAILCOACH_API_URL=your_mailcoach_api_url
KP_MAILCOACH_API_TOKEN=your_mailcoach_api_token
If you're using Laravel 5.5+ you don't need to manually add the service provider or facade. This will be
Auto-Discovered. For all versions of Laravel below 5.5, you must manually add the ServiceProvider & Facade to the
appropriate arrays within your Laravel project config/app.php
[
Kevinpurwito\LaravelMailcoachApi\MailcoachApiServiceProvider::class,
];
[
'MailcoachApi' => Kevinpurwito\LaravelMailcoachApi\Facades\MailcoachApi::class,
];
use Kevinpurwito\LaravelMailcoachApi\Facades\MailcoachApi;
MailcoachApi::getSubscribers();
use Kevinpurwito\LaravelMailcoachApi\MailcoachApi;
use Kevinpurwito\LaravelMailcoachApi\Data\InputSubscriberData;
$mcApi = (new MailcoachApi(url: '', token: ''));
$data = new InputSubscriberData(email: '', first_name: '', last_name: '');
$subscriber = $mcApi->addSubscriber(listId: 0, data: $data);
composer test
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.
This package was generated using the PHP Package Boilerplate by Beyond Code with some modifications inspired from PHP Package Skeleton by spatie.