jeffersongoncalves / laravel-mention-me
Mention Me referral marketing API integration for Laravel
Package info
github.com/jeffersongoncalves/laravel-mention-me
pkg:composer/jeffersongoncalves/laravel-mention-me
Requires
- php: ^8.2
- illuminate/http: ^12.0|^13.0
- illuminate/support: ^12.0|^13.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.21
- orchestra/testbench: ^10.0|^11.0
- pestphp/pest: ^3.0|^4.0
- pestphp/pest-plugin-laravel: ^3.0|^4.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Laravel Mention Me
A Laravel client for the Mention Me referral marketing API. A fluent MentionMe facade covers referrer offers, referrals, share links, rewards and referees, authenticates every request with a Bearer token, and throws a MentionMeException on a non-2xx response instead of returning a silent error array.
Features
- Referrer Offers —
createReferrerOffer() - Referrals —
getReferral(),listReferrals() - Share Links —
getShareLinks() - Rewards —
getRewards(),redeemReward() - Referees —
createReferee() - Thin by design — every method returns the raw decoded JSON response as an array, no DTOs
- Fails loud — a non-2xx API response throws
MentionMeExceptioncarrying the API's error message and HTTP status code
Installation
You can install the package via composer:
composer require jeffersongoncalves/laravel-mention-me
Optionally publish the config file:
php artisan vendor:publish --tag="mention-me-config"
Configuration
Add to your .env:
MENTIONME_API_KEY=your-api-key
Config Options
// config/mention-me.php return [ 'api_key' => env('MENTIONME_API_KEY'), 'base_url' => env('MENTIONME_BASE_URL', 'https://api.mention-me.com/api/v2'), ];
Usage
use JeffersonGoncalves\LaravelMentionMe\Exceptions\MentionMeException; use JeffersonGoncalves\LaravelMentionMe\Facades\MentionMe;
Create a referrer offer
Turn a customer into a referrer.
MentionMe::createReferrerOffer([ 'email' => 'jane@example.com', 'firstname' => 'Jane', 'lastname' => 'Doe', 'order_number' => 'ORD-1', 'order_total' => 99.50, 'order_currency' => 'GBP', ]);
Get a referral
MentionMe::getReferral('referral-id');
List a referrer's referrals
MentionMe::listReferrals('customer-id');
Get a referrer's share links
MentionMe::getShareLinks('customer-id');
Get a referrer's rewards
MentionMe::getRewards('customer-id');
Redeem a reward
MentionMe::redeemReward('customer-id', rewardId: 'reward-id', orderNumber: 'ORD-2');
Create a referee
Record a new customer referred by a referrer.
MentionMe::createReferee([ 'email' => 'john@example.com', 'firstname' => 'John', 'referrer_code' => 'REF-1', 'order_number' => 'ORD-3', 'order_total' => 42.00, ]);
Handling errors
try { $result = MentionMe::getReferral('referral-id'); } catch (MentionMeException $e) { // $e->getMessage() — the API's error message, or the raw response body // $e->statusCode — the HTTP status code returned by Mention Me }
Testing
composer test
Static Analysis
composer analyse
Code Formatting
composer format
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
