Looking to hire Laravel developers? Try LaraJobs

laravel-partner maintained by yamuf

Description
Official Laravel integration for the Yamuf developer and partner platform.
Last update
2026/08/15 01:12 (dev-main)
License
Links
Downloads
0
Tags

Comments
comments powered by Disqus

Yamuf Laravel Partner

Official Laravel integration for the Yamuf developer and partner platform. Yamuf remains the source of truth for catalogue data, Course Match, and partner leads.

Installation

composer require yamuf/laravel-partner
php artisan vendor:publish --tag=yamuf-config
YAMUF_API_URL=https://api.yamuf.com
YAMUF_API_KEY=your-server-side-key
YAMUF_LOCALE=fr

For local package development, use a Composer path repository and yamuf/laravel-partner:@dev. The local API documentation is available at http://local.yamufapi.com/docs/api.

Usage

use Yamuf\Laravel\Facades\Yamuf;

$partner = Yamuf::partner()->me();
$universities = Yamuf::universities()->list(['per_page' => 6]);
$programmes = Yamuf::programmes()->list(['university' => $universityUuid]);
$countries = Yamuf::catalogue()->countries();

Search

Search runs against Yamuf's public catalogue API; the package does not download or search catalogue pages locally.

$results = Yamuf::search()->all('informatique');

$universities = Yamuf::search()->universities('Dakar');

$programmes = Yamuf::search()->programmes(
    'Génie Informatique',
    [
        'locale' => 'fr',
        'study_level' => 4,
        'field' => 227,
        'per_page' => 10,
    ]
);

foreach ($results->items() as $result) {
    echo $result->type;
    echo $result->score;
    echo $result->item->name;
}

$french = Yamuf::locale('fr')->search()->universities('Dakar');

Search supports locale, page, per_page, country, and city. Programme search also supports university, study_level, and field. Unified search supports type (all, university, or programme). Search GET requests use the same safely scoped cache as catalogue requests; query, type, locale, filters, and pagination are cache-key dimensions.

Catalogue pagination returns a typed wrapper:

$page = Yamuf::universities()->paginate(['page' => 2]);
$page->items();
$page->currentPage();
$page->lastPage();

Course Match

$options = Yamuf::courseMatch()->options();
$match = Yamuf::courseMatch()->create([
    'current_education_level' => 'bachelor',
    'intended_study_level' => 'masters',
    'fields' => ['computer-science'],
    'destination_countries' => ['senegal'],
    'country_of_residence' => 'senegal',
    'start_period' => '2026-2027',
]);

$saved = Yamuf::courseMatch()->find($match->uuid);

Partner subscriptions and inquiries

Yamuf::subscriptions()->create([
    'first_name' => 'Amina', 'last_name' => 'Ndiaye',
    'email' => 'amina@example.com', 'country_code' => 'SN',
    'accepted_terms' => true, 'marketing_opt_in' => false,
    'campaign' => 'partner-homepage',
    'source_url' => request()->fullUrl(),
    'referrer_url' => request()->header('referer'),
]);

Yamuf::inquiries()->create([
    'first_name' => 'Amina', 'email' => 'amina@example.com',
    'subject' => 'Question about studying',
    'message' => 'I would like to know which programmes accept my diploma.',
    'accepted_terms' => true, 'marketing_opt_in' => false,
]);

The API derives partner identity from the API key. The package strips partner and partner_slug from writes; applications cannot attribute a lead to another partner.

Dependency injection and locale

use Yamuf\Laravel\Contracts\YamufClientContract;

final class UniversityController {
    public function __construct(private readonly YamufClientContract $yamuf) {}
    public function index() { return $this->yamuf->locale('fr')->universities()->list(); }
}

Only en and fr are accepted. The package sends Accept-Language; the current Yamuf API has no Com-Language contract.

Errors and testing

use Yamuf\Laravel\Exceptions\ValidationException;

try { Yamuf::subscriptions()->create($data); }
catch (ValidationException $e) { $errors = $e->errors(); }

$fake = Yamuf::fake([
    'universities' => [['id' => 'u1', 'slug' => 'example', 'name' => 'Example']],
    'search.programmes' => [['uuid' => 'p1', 'slug' => 'genie', 'name' => 'Génie Informatique']],
]);
Yamuf::search()->programmes('informatique');
$fake->assertSearchPerformed(fn ($search) => $search->query === 'informatique');
Yamuf::subscriptions()->create(['email' => 'test@example.test']);
$fake->assertSubscriptionSent(fn (array $data) => $data['email'] === 'test@example.test');

Security

Never expose YAMUF_API_KEY to browser JavaScript, Blade data attributes, frontend environment variables, public APIs, logs, or client-side applications. Call Yamuf only from controllers, services, jobs, commands, or server-side Livewire/Inertia endpoints. SPA and mobile clients must use their own backend to mediate protected requests.

GET catalogue requests may be cached. Partner identity, writes, validation errors, and personal lead data are never cached. Writes are never automatically retried.

API documentation

Use the Yamuf developer API documentation for scopes, schemas, and endpoint details. Available integrations are direct REST API, the WordPress Partner plugin, and this official package. composer require yamuf/laravel-partner installs it from Packagist.