kevinpurwito / laravel-mailcoach-api
Mailcoach API integration for Laravel
Fund package maintenance!
kevinpurwito
www.paypal.me/kevinpurwito
Installs: 1 832
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^8.1
- guzzlehttp/guzzle: ^7.5
- spatie/laravel-data: ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- orchestra/testbench: ^6.0|^7.0
- phpunit/phpunit: ^9.0
- vimeo/psalm: ^4.3
README
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
Installation
You can install the package via composer:
composer require kevinpurwito/laravel-mailcoach-api
Configuration
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
Auto Discovery
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
Provider
[ Kevinpurwito\LaravelMailcoachApi\MailcoachApiServiceProvider::class, ];
Alias / Facade
[ 'MailcoachApi' => Kevinpurwito\LaravelMailcoachApi\Facades\MailcoachApi::class, ];
Usage
Using Facade
use Kevinpurwito\LaravelMailcoachApi\Facades\MailcoachApi; MailcoachApi::getSubscribers();
Using Class
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);
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email kevin.purwito@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
Laravel Package Boilerplate
This package was generated using the PHP Package Boilerplate by Beyond Code with some modifications inspired from PHP Package Skeleton by spatie.