Saltar al contenido
← Volver a proyectos

Laravel Mention Me

Mention Me referral marketing API integration for Laravel

Laravel Mention Me

#Laravel Mention Me

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads License

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 OfferscreateReferrerOffer()
  • ReferralsgetReferral(), listReferrals()
  • Share LinksgetShareLinks()
  • RewardsgetRewards(), redeemReward()
  • RefereescreateReferee()
  • Thin by design — every method returns the raw decoded JSON response as an array, no DTOs
  • Fails loud — a non-2xx API response throws MentionMeException carrying 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.

Nueva versión disponible.