Community코딩 & 개발github.com

Taldres/laravel-waitlist

Brevo, Mailchimp 또는 Mailcoach와 같은 뉴스레터 도구를 taldres/laravel-waitlist 대기 목록과 동기화합니다: 목적별로 확인된 연락처를 추가하고, 철회 및 삭제 시 제거하며, 제공업체에서 수행된 구독 취소를 웹훅을 통해 대기 목록으로 다시 가져옵니다.

laravel-waitlist란 무엇인가요?

이 스킬은 `taldres/laravel-waitlist` 패키지를 사용하는 Laravel 애플리케이션에서 외부 이메일 뉴스레터 도구(Brevo, Mailchimp, Mailcoach 등)의 연락처 목록을 애플리케이션 내부 대기 목록의 동의 상태와 동기화하는 방법을 설명합니다. 주요 목표는 제공업체가 현재 유효한 목적에 대해서만 연락처를 보유하도록 하고, 대기 목록이나 제공업체 중 한쪽에서 철회가 발생하면 다른 쪽에도 반영되도록 하는 것입니다. 이 스킬은 이벤트 리스너를 통해 대기 목록 이벤트(EntryConfirmed, ConsentGranted, ConsentWithdrawn 등)를 제공업체 API 호출에 매핑하고, 제공업체의 구독 취소 웹훅을 수신하여 대기 목록에 반영하는 전체 워크플로를 제공합니다. 또한 제공업체 API 호출을 위한 암호화된 큐 리스너 클래스 구현, 중복 이벤트 처리를 방지하기 위한 수동 이벤트 등록, 여러 프로젝트 처리 방법, 그리고 일반적인 안티 패턴(예: 확인되지 않은 구독에 대한 동기화, 다른 목록을 확인하지 않고 연락처 삭제)을 방지하는 방법을 다룹니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Taldres/laravel-waitlist/tree/HEAD/resources/boost/skills/laravel-waitlist-provider-sync

Installed? Explore more 코딩 & 개발 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

Laravel Waitlist: 이메일 제공업체에 동기화하기

taldres/laravel-waitlist를 사용하는 애플리케이션이 외부 뉴스레터 도구에서 캠페인을 보내고 해당 연락처 목록이 대기 목록의 동의를 따라야 할 때 이 스킬을 사용하십시오.

주요 목표

  • 제공업체는 목적이 유효한 연락처만 보유하며, 한쪽에서 철회가 발생하면 다른 쪽에도 전달됩니다.

워크플로

1. 동기화가 필요한지 결정

Laravel 앱이 자체적으로 보내는 메일(어떤 메일러를 통하든)에는 동기화가 필요하지 않습니다. Waitlist::recipients($purpose)로 보내면 됩니다. 캠페인이 도구에서 전송되는 경우에만 동기화하십시오.

2. 이벤트를 제공업체 호출에 매핑

이벤트제공업체 작업
EntryConfirmed연락처 추가, $event->entry->purposes의 각 목적당 하나의 제공업체 목록에
ConsentGranted해당 목적의 목록에 추가, 단 $event->subscription->isConfirmed()가 참일 때
ConsentWithdrawn$event->consent->purpose의 목록에서 제거, 단 프로젝트의 다른 목록이 여전히 보유하고 있지 않은 경우
EntryUnsubscribed사이클이 보유한 모든 목적의 목록에서 제거, 단 다른 목록이 여전히 보유하고 있지 않은 경우
EntryForgotten해당 주소의 항목이 더 이상 없을 때만 연락처 삭제; 그렇지 않으면 남은 항목이 보유하지 않은 목적을 제거
  • 목록을 떠나면 해당 목록의 모든 목적에 대한 사이클이 종료됩니다. 해당 목록에서 동의된 뉴스레터도 종료되며 ConsentWithdrawn이 발생하지 않습니다.
  • EntryForgotten은 삭제된 모든 항목에 대해 발생하며, forgetAll() 및 한 목록의 보존 정리에도 발생하지만, 주소는 다른 목록에 여전히 있을 수 있습니다.
  • EntrySubscribed에서는 동기화하지 마십시오: 더블 옵트인의 경우 주소가 확인되지 않았습니다.

3. 하나의 큐 처리 및 암호화된 리스너 클래스

namespace App\Listeners;

use Illuminate\Contracts\Queue\ShouldBeEncrypted;
use Illuminate\Contracts\Queue\ShouldQueue;
use Taldres\Waitlist\Events\ConsentGranted;
use Taldres\Waitlist\Events\ConsentWithdrawn;
use Taldres\Waitlist\Events\EntryConfirmed;
use Taldres\Waitlist\Events\EntryForgotten;
use Taldres\Waitlist\Events\EntryUnsubscribed;
use Taldres\Waitlist\Models\WaitlistEntry;

class SyncWaitlistToProvider implements ShouldQueue, ShouldBeEncrypted
{
    public function onConfirmed(EntryConfirmed $event): void
    {
        // $event->entry->email을 $event->entry->purposes의 각 제공업체 목록에 추가
    }

    public function onGranted(ConsentGranted $event): void
    {
        if ($event->subscription->isConfirmed()) {
            // $event->entry->email을 $event->consent->purpose의 목록에 추가
        }
    }

    public function onWithdrawn(ConsentWithdrawn $event): void
    {
        $this->removeUnlessHeld($event->entry->project, $event->entry->email, $event->consent->purpose);
    }

    public function onUnsubscribed(EntryUnsubscribed $event): void
    {
        $event->subscription->consents()->pluck('purpose')->unique()->each(
            fn (string $purpose) => $this->removeUnlessHeld($event->entry->project, $event->entry->email, $purpose),
        );
    }

    public function onForgotten(EntryForgotten $event): void
    {
        if ($event->email === null) {   // 복호화할 수 없음
            return;
        }

        if (! WaitlistEntry::query()->forEmail($event->email)->exists()) {
            // 연락처 $event->email 삭제
            return;
        }

        foreach (['waitlist', 'newsletter'] as $purpose) {   // 동기화하는 목적
            $this->removeUnlessHeld($event->project, $event->email, $purpose);
        }
    }

    private function removeUnlessHeld(string $project, string $email, string $purpose): void
    {
        // 이벤트는 커밋 후에 발생합니다: 목적이 여전히 유효한 것은 프로젝트의 다른 목록이 보유하고 있을 때만입니다.
        $held = WaitlistEntry::query()->inProject($project)->forEmail($email)->whereConsentedTo($purpose)->exists();

        if (! $held) {
            // $purpose에 대한 제공업체 목록에서 $email 제거
        }
    }
}

메서드를 수동으로 등록하십시오. 의도적으로 handle로 시작하지 않으므로 Laravel의 이벤트 자동 발견이 다시 등록하지 않습니다:

// AppServiceProvider::boot()
Event::listen(EntryConfirmed::class, [SyncWaitlistToProvider::class, 'onConfirmed']);
Event::listen(ConsentGranted::class, [SyncWaitlistToProvider::class, 'onGranted']);
Event::listen(ConsentWithdrawn::class, [SyncWaitlistToProvider::class, 'onWithdrawn']);
Event::listen(EntryUnsubscribed::class, [SyncWaitlistToProvider::class, 'onUnsubscribed']);
Event::listen(EntryForgotten::class, [SyncWaitlistToProvider::class, 'onForgotten']);

제공업체 API에는 Laravel의 Http 클라이언트를 사용하십시오. 자격 증명과 목적별 목록 ID는 config/services.php에 보관하십시오.

4. 제공업체의 구독 취소를 다시 가져오기

도구의 캠페인에는 자체 구독 취소 링크가 포함됩니다. 해당 웹훅을 수신하고 주소의 모든 목록에서 목적을 철회하십시오. 반복해도 변경 사항은 없습니다:

// routes/api.php, 또는 CSRF 보호에서 제외된 라우트를 사용하는 routes/web.php
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use Taldres\Waitlist\Facades\Waitlist;
use Taldres\Waitlist\Models\WaitlistEntry;

Route::post('/webhooks/newsletter', function (Request $request) {
    // 먼저 제공업체 문서대로 웹훅을 검증합니다
    $email = (string) $request->input('email'); // 필드 이름은 제공업체에 따라 다릅니다

    Waitlist::findByEmail($email)->each(
        fn (WaitlistEntry $entry) => Waitlist::for($entry->list)->withdraw($email, 'newsletter'),
    );

    return response()->noContent();
});

여러 프로젝트: 제공업체 목록을 해당 프로젝트에 매핑하고 Waitlist::project($project)->findByEmail() 및 Waitlist::project($project)->for($entry->list)->withdraw()를 사용하십시오.

규칙, 참조 및 템플릿

  • 프로젝트 및 목적당 하나의 제공업체 목록; 선택적 목적을 위해 대기 목록당 하나의 목록을 사용하지 마십시오. 선택적 목적은 프로젝트당 하나의 동의이기 때문입니다.
  • 기본 목적을 공유하는 목록은 별도의 대기 목록입니다. 하나를 떠나도 다른 목록이 여전히 목적을 보유하고 있으면 연락처가 제거되지 않습니다.
  • php artisan waitlist:privacy는 리스너를 수신자로 나열합니다. 제공업체는 처리자이며 계약이 필요합니다.
  • 완전한 Brevo 리스너가 포함된 전체 가이드: https://github.com/Taldres/laravel-waitlist/blob/main/docs/email-provider-sync.md

예제

  • "확인된 뉴스레터 가입을 Brevo에 동기화": 2단계와 3단계, 목록 ID로 config('services.brevo.lists.newsletter') 사용.
  • "Mailchimp에서 구독 취소한 사람들이 여전히 출시 메일을 받는 경우": 4단계.

안티 패턴

  • EntrySubscribed에서 더블 옵트인 전에 동기화.
  • EntryUnsubscribed에서 프로젝트의 다른 목록을 확인하지 않고 연락처를 제거하거나 목록의 기본 목적만 제거.
  • 모든 EntryForgotten에서 연락처를 삭제: 보존 정리 및 forgetAll()은 주소가 다른 목록에 여전히 있을 수 있는 동안 하나의 목록을 삭제합니다.
  • 리스너 메서드 이름을 handle*로 지정하고 Event::listen()으로도 등록: 모든 동기화가 두 번 실행됩니다.
  • 하나의 항목에서만 철회하거나 요청을 검증하지 않고 신뢰하는 웹훅.
  • 전달된 EntryForgotten을 제공업체가 연락처를 삭제했다는 증거로 간주; 실패한 작업을 모니터링하십시오.

Individual skills in this repo

This repo contains 13 individual skills — each has its own dedicated page.

Taldres/laravel-waitlist

Use this skill when reviewing Laravel package compatibility across composer constraints, PHP versions, Laravel versions, Testbench versions, dependency stability lanes, Windows CI, or matrix-sensitive code and workflow changes.

Taldres/laravel-waitlist

Use this skill when creating or updating the bundled Laravel Boost skill under resources/boost/skills from the package implementation and package documentation. Trigger after public APIs, commands, config, routes, views, publish tags, README content, or examples change.

Taldres/laravel-waitlist

Use this skill when preparing Laravel package releases: CHANGELOG.md updates, generated release notes, GitHub release workflows, version checks, tags, release validation, or release automation changes. Never publish autonomously.

Taldres/laravel-waitlist

Use this skill when adding Laravel package capabilities or wiring them through the service provider: commands, migrations, routes, config merges, views, translations, assets, middleware, publish tags, workbench files, or console-only behavior.

Taldres/laravel-waitlist

Use this skill when writing, editing, fixing, or reviewing package tests with Pest 4/5 and Orchestra Testbench, including TDD, feature tests, unit tests, type coverage, arch tests, workbench behavior, commands, routes, config, migrations, and publishable resources.

Taldres/laravel-waitlist

Integrate taldres/laravel-waitlist in a Laravel application: define purposes, lists and fields, build the signup form, send the confirmation mail from events, add a preference page, and keep consent, retention and encryption intact.

Taldres/laravel-waitlist

Build the pages of a taldres/laravel-waitlist integration: the signup form with the registered wording, and the confirm, unsubscribe and preference pages, either in Laravel controllers (Blade, Livewire, Inertia) or in an SPA or static site over the package's JSON API, including CORS and bot protection.

Taldres/laravel-waitlist

Turn a taldres/laravel-waitlist waitlist into a launch: invite people in batches in signup order, let invited addresses register, announce the launch to everyone who agreed, and erase the list once its purpose is fulfilled.

Taldres/laravel-waitlist

Send the mails of a taldres/laravel-waitlist integration: the double opt-in confirmation, the preference page link, a welcome mail, launch mails and newsletters to the people who agreed, with the right unsubscribe links, one-click headers and a sender per project.

Taldres/laravel-waitlist

Operate a taldres/laravel-waitlist installation: answer access and erasure requests, withdraw a purpose on request, apply retention, erase a list once its purpose is fulfilled, rotate APP_KEY with waitlist:rekey, export a list, and check the setup before going live.

Taldres/laravel-waitlist

Run the waitlists of several products in one Laravel app with taldres/laravel-waitlist projects: define projects, scope facade calls with project(), resolve the project of HTTP signups, send mail per project, handle requests across all projects, or keep projects in a database for a central waitlist API.

Taldres/laravel-waitlist

Build waitlist statistics with taldres/laravel-waitlist: signups and confirmations per day for charts, totals and confirmation rates for a period, the confirmed count on any past day, and how many people are on a list right now, for dashboards, admin pages and API endpoints.

Taldres/laravel-waitlist

Write feature tests for an application's taldres/laravel-waitlist integration: get the plain tokens from events, assert the confirmation and other mails, test the signup, confirm and unsubscribe flows in PHP and over the package's HTTP routes, and bypass rate limits and bot checks in tests.

관련 스킬