Community코딩 & 개발github.com

Taldres/laravel-waitlist (다중 프로젝트)

하나의 Laravel 앱에서 여러 제품의 대기열(waitlist)을 운영합니다. 프로젝트를 정의하고, facades 호출을 project()로 범위 지정하며, HTTP 가입 시 프로젝트를 해석하고, 프로젝트별로 메일을 전송하며, 모든 프로젝트에 걸친 요청을 처리하거나 데이터베이스에 프로젝트를 저장하여 중앙 대기열 API를 제공합니다.

laravel-waitlist (다중 프로젝트)란 무엇인가요?

이 기술은 Laravel 애플리케이션에서 여러 제품의 대기열을 단일 앱 내에서 관리할 수 있게 해줍니다. 각 프로젝트는 고유한 목적, 리스트, 필드 및 페이지를 가지며, 기본 프로젝트나 다른 프로젝트로부터 아무것도 상속받지 않습니다. 주요 사용 사례로는 여러 SaaS 제품의 대기열을 별도로 운영하거나, 중앙 API를 통해 여러 클라이언트의 대기열을 관리하는 경우가 있습니다. 이 기술은 Claude Code, Cursor, Cline, Codex, Windsurf 등 모든 AI 코딩 에이전트와 호환됩니다. 작동 방식은 다음과 같습니다: 먼저 각 제품을 위한 프로젝트를 Waitlist::define()으로 정의하고, 모든 호출을 Waitlist::project('키')->... 로 범위를 지정합니다. HTTP 가입의 경우 ProjectResolver를 바인딩하여 들어오는 요청이 어떤 프로젝트에 속하는지 결정합니다. 게이트(gate) 시스템으로 인증 및 권한을 관리하며, 프로젝트별로 메일 템플릿과 발신자를 설정할 수 있습니다. 또한 Waitlist::allProjects()를 사용하여 GDPR 요청 등 모든 프로젝트에 걸친 개인 데이터 작업을 지원합니다. 프로젝트를 데이터베이스에 저장하여 동적으로 추가/제거할 수도 있습니다.

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

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

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

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

문서

Laravel Waitlist: 여러 프로젝트

하나의 애플리케이션이 둘 이상의 제품 대기열을 수집하거나, 기존 taldres/laravel-waitlist 설정에 두 번째 제품을 추가할 때 이 기술을 사용합니다. 단일 제품의 경우 다음 내용은 필요하지 않습니다. 이름 없이 Waitlist::define()을 호출하면 default 프로젝트가 생성됩니다.

주요 목표

  • 모든 호출, 가입 및 메일이 올바른 제품에 대해 동작해야 하며, 어떤 것도 기본 프로젝트로 조용히 넘어가서는 안 됩니다.

워크플로우

1. 프로젝트 정의하기

각 프로젝트는 고유한 목적, 리스트, 필드 및 페이지를 가집니다. 기본 프로젝트나 다른 프로젝트로부터 상속되는 것은 없습니다. 리스트 이름은 프로젝트 내에서만 고유하면 됩니다.

// app/Providers/WaitlistServiceProvider.php, boot()
use Taldres\Waitlist\Definitions\ProjectDefinition;
use Taldres\Waitlist\Facades\Waitlist;

// 기본 프로젝트는 리스트 없이 유지됩니다. project()를 잊은 가입은 잘못된 제품에 들어가는 대신 실패합니다.
// 기본 프로젝트의 페이지는 알 수 없는 토큰을 처리합니다.
Waitlist::define(fn (ProjectDefinition $project) => $project->urls(
    invalid: 'https://example.com/waitlist/oops',
));

Waitlist::define('rocket', function (ProjectDefinition $project): void {
    $project->purpose('waitlist', ['2026-10' => '로켓이 출시되면 이메일을 보내주세요.']);
    $project->list('default', purpose: 'waitlist');
    $project->fields(fn () => ['source' => ['nullable', 'string', 'max:50']]);
    $project->urls(
        confirm: 'https://rocket.example/waitlist/confirm/{token}',
        unsubscribe: 'https://rocket.example/waitlist/leave/{token}',
        manage: 'https://rocket.example/waitlist/preferences/{token}',
    );
});

Waitlist::define('anvil', function (ProjectDefinition $project): void { /* 동일한 메서드 */ });
  • 주 제품을 기본 프로젝트에 유지하고 나머지에 이름을 부여하는 방식도 작동합니다. 이 경우 project() 없이 호출되면 주 제품에 대해 동작합니다.
  • 필드는 프로젝트 및 리스트별로 적용됩니다. $project->fields()는 모든 리스트에 적용되며, 리스트 자체의 ->fields()는 그 위에 추가됩니다. 한 프로젝트의 필드가 다른 프로젝트에 영향을 미치지 않으며, 필드가 없는 프로젝트는 HTTP를 통해 메타데이터를 받지 않습니다.
  • 환경 변수는 config()를 통해 읽고, env()는 사용하지 마십시오. 프로젝트를 다시 정의하면 이전 정의를 대체합니다. 콜백은 프로젝트가 처음 필요할 때 실행됩니다.

2. 모든 호출 범위 지정하기

Waitlist::project('rocket')->for('default')->add($email, $purposes);
Waitlist::project('rocket')->purposes('default', app()->getLocale());
Waitlist::project('rocket')->recipients('newsletter');
Waitlist::project('rocket')->report()->since(30)->totals();
  • project() 없이 호출하면 facade는 기본 프로젝트에 대해 동작하며, 전체에 대해 동작하지 않습니다.
  • 토큰 메서드(Waitlist::confirm(), unsubscribe(), withdrawConsent(), requestManageLink())는 프로젝트가 필요하지 않습니다. 토큰은 해당 항목에 속합니다.
  • 알 수 없는 프로젝트는 UnknownProjectException을 던집니다.

3. HTTP 가입에는 해석기(resolver)가 필요합니다

WAITLIST_ROUTES_ENABLED=true인 경우, 주소로 요청된 가입, 문구 및 관리 링크는 ProjectResolver가 반환하는 프로젝트에 대해 동작합니다. 기본 DefaultProjectResolver는 항상 default를 반환하므로, 직접 바인딩해야 합니다:

namespace App\Waitlist;

use Illuminate\Http\Request;
use Taldres\Waitlist\Contracts\ProjectResolver;

class SiteResolver implements ProjectResolver
{
    public function resolve(Request $request): string
    {
        $host = parse_url((string) $request->headers->get('Origin'), PHP_URL_HOST) ?: $request->getHost();

        return match ($host) {
            'rocket.example' => 'rocket',
            'anvil.example' => 'anvil',
            default => abort(403),
        };
    }
}
// config/waitlist.php
'project_resolver' => App\Waitlist\SiteResolver::class,
  • list 없이 가입하면 해석된 프로젝트의 waitlist.default_list(default)로 들어갑니다. 각 프로젝트에 해당 이름의 리스트를 만들거나, 항상 list를 함께 전송하십시오.
  • 해석기는 요청당 한 번, 가장 먼저 실행되며, 그 다음 useWaitlist 게이트가 실행됩니다. 둘 다 본문 검증 전에 실행됩니다. 프로젝트가 허용하는 필드를 결정하며, 거부된 요청은 읽히지 않은 상태로 401/403으로 응답합니다.
  • 해석기에서 알 수 없는 프로젝트인 경우: 가입은 422, 문구 요청은 404로 응답합니다.
  • 자체 컨트롤러는 해석기가 필요하지 않습니다. 직접 Waitlist::project(...)를 호출하십시오.
  • waitlist.routes.middleware에서 인증을 수행하지 마십시오. 이 미들웨어는 토큰 링크도 보호합니다.

3b. 호출 권한: useWaitlist 게이트와 자격 증명을 가진 서버

이 패키지는 가입, 문구 및 주소별 관리 링크(토큰 링크는 제외)에 대해 Laravel의 useWaitlist 게이트를 확인합니다. 게이트에는 (?Authenticatable $caller, string $project, WaitlistAction $action, ?string $list)가 전달됩니다. 호출자는 waitlist.authentication.guards에서 요청을 인증하는 첫 번째 가드에서 제공됩니다. Waitlist::caller($request)도 동일한 값을 반환합니다. config/auth.php에 정의되지 않은 가드는 거부됩니다. 토큰 링크는 이 게이트를 기다리지 않으며, 게스트 요청으로 제한됩니다.

  • 기본값: 모든 사람이 접근 가능합니다. 단, 호출자가 HasWaitlistProject를 구현한 경우 자신의 프로젝트에 대해서만 접근 가능하며, 그 외의 경우 404를 반환합니다. waitlist.authentication.required가 설정된 경우: 게스트는 401, 프로젝트가 없는 호출자는 403을 받습니다.
  • 게이트를 교체하려면 Gate::define('useWaitlist', ...)를 아무 provider에서나 호출하면 됩니다. 먼저 부팅되는 provider의 정의가 우선합니다. bool 또는 게이트 응답을 반환합니다. Response::denyWithStatus(401) 및 denyAsNotFound()는 클라이언트에 전달됩니다.
  • 자체 토큰으로 호출하는 서버: 토큰의 모델이 HasWaitlistProject를 구현하고, project_resolver가 AuthenticatedProjectResolver(호출자 없으면 401, 프로젝트 없거나 정의되지 않은 프로젝트면 403)이며, authentication.guards에 토큰 가드가 명시되고, authentication.required가 활성화되어야 합니다. 토큰 발급/폐기는 앱에서 처리하며(Sanctum, Passport, JWT 가드), 이 또한 게이트로 보호해야 합니다(예: Sanctum::authenticateAccessTokensUsing()와 Waitlist::hasProject() 사용).
  • Sanctum 권한(abilities)은 can()(게이트와 정책을 확인)이 아닌 tokenCan()으로 읽습니다.
  • 이러한 서버는 모든 방문자를 대신하여 하나의 주소에서 요청을 보냅니다. 기본 rate limiter는 각 서버를 제한하며(rate_limits.caller_signup_per_minute, 120), 방문자별 제한은 서버에 맡깁니다(예: Next.js Server Action). authentication.client_ip_header(예: X-Waitlist-Client-Ip)를 설정하면 전달된 방문자별로도 제한할 수 있습니다. 이 헤더는 게스트로부터는 읽히지 않으며, IP 주소 형식이 아닌 값은 무시됩니다.
  • $project->wordingFromCallers()를 사용하면 서버가 동의 텍스트를 버전과 함께 보낼 수 있습니다({version, locale?, text}). 텍스트는 사이트에만 존재합니다. 첫 번째 가입이 텍스트를 서버에 등록하며, 알려진 버전은 동일한 텍스트를 반환해야 합니다. 게이트는 이러한 가입에 대해 WaitlistAction::RegisterWording을 확인합니다. 기본적으로는 프로젝트를 위해 동작하는 호출자만 허용됩니다.

4. 프로젝트별 메일

리스너(listener)는 $event->entry->project를 읽고 발신자, 메일러 및 템플릿을 선택합니다. 메일 링크는 이미 프로젝트 자체 페이지(urls())를 가리킵니다. urls()가 없는 프로젝트는 패키지 라우트를 사용하거나, 라우트가 비활성화된 경우 null을 사용합니다.

5. 개인에 대한 요청은 모든 프로젝트를 포함합니다

Waitlist::allProjects()->personalData($email);
Waitlist::allProjects()->forget($email);
Waitlist::allProjects()->report();

waitlist:show, waitlist:forget, waitlist:prune 및 waitlist:privacy 명령은 --project 없이 실행하면 모든 프로젝트를 포함합니다. --list 옵션을 사용하면 기본 프로젝트의 해당 리스트로 범위가 좁혀집니다. waitlist:export, waitlist:wording 및 waitlist:forget --all은 --project가 지정되지 않은 경우 기본 프로젝트에 대해 동작합니다.

6. 데이터베이스에 저장된 프로젝트

런타임에 프로젝트를 추가/제거하거나, 자체 리스트와 문구를 관리해야 하는 경우 ProjectCatalog(waitlist.catalog)를 바인딩합니다. 일반적으로 StoredWordingCatalog를 확장하며, policy(), fields()(필드 => 규칙, 저장된 규칙은 문자열만 가능), urlPattern(), projects()(default 포함 필수), lists() 및 게시 가능한 키를 프로젝트에 매핑하는 해석기를 함께 구현합니다. 자체 카탈로그는 정의를 대체합니다. 프로젝트는 Waitlist::project($key)->registerWording()으로 문구를 등록합니다.

규칙, 참조 및 템플릿

예제

  • "두 번째 제품을 위한 대기열 추가": 첫 번째 제품을 기본 프로젝트에 유지하거나 이름을 부여하고, 두 번째 제품을 위해 Waitlist::define('<key>', ...)를 추가한 후, project()로 호출 범위를 지정하고, HTTP 가입이 있을 경우 해석기를 바인딩합니다.
  • "[email protected]에 관한 모든 데이터 삭제": Waitlist::allProjects()->forget('[email protected]')

안티 패턴

  • 여러 프로젝트가 있고 해석기 없이 패키지 라우트를 활성화하는 경우: 모든 HTTP 가입이 default로 들어갑니다.
  • 기본 게이트에 의존하여 API를 잠그는 경우: waitlist.authentication.required 또는 AuthenticatedProjectResolver 없이는 토큰을 생략한 호출자가 게스트로 간주되며, 게스트도 접근할 수 있습니다.
  • 자체 프로젝트가 있는 제품에 대해 Waitlist::for($list)를 호출하는 경우.
  • 프로젝트가 기본 프로젝트의 목적, 리스트, 필드 또는 페이지를 상속받을 것이라고 기대하는 경우.
  • 사용자가 여러 제품에 있을 때 Waitlist::project($key)->forget()으로 삭제 요청에 응답하는 경우.

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

Keep a newsletter tool such as Brevo, Mailchimp or Mailcoach in step with a taldres/laravel-waitlist waitlist: add confirmed contacts per purpose, remove them on withdrawal and erasure, and carry unsubscribes made at the provider back into the waitlist via a webhook.

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.

관련 스킬