smidgen/php

PHP / Laravel

Easy: GateClient for bots + snippet blur. Hard lock: UnlockClient::hasValidUnlock before render, then UnlockClient::lockedMarkup for unpaid responses.

Before you start

Replace placeholder values like smid_YOUR_PROJECT_ID and https://yoursite.com with your project ID and site origin from the dashboard.

  • A smidgen.io project — copy your project ID from the dashboard
  • Add https://yoursite.com under Allowed websites in project settings
  • Create at least one paywall rule whose path and selector match your premium content
  • Set a payout wallet (Base or Solana) to receive USDC
  • API base URL: https://smidgen.io

Browser snippet

Easy: wallet checkout via snippet.js with data-x402-paywall. Hard lock: see the Hard lock tab.

Gate client

HTTP 402 + x402 payment instructions for agents

Quick setup

Create a project in the smidgen dashboard, then follow these steps on your site.

  1. composer require smidgen/php (path repo or Packagist when published).
  2. Bots: call GateClient before serving premium routes.
  3. Hard lock: UnlockClient::hasValidUnlock — if locked, echo lockedMarkup (teaser + empty mount).
  4. Add the browser snippet in your layout for human visitors.
  5. Add https://yoursite.com to Allowed websites.

composer.json (path repo for local dev)

json

{
  "repositories": [
    { "type": "path", "url": "../integrations/php" }
  ],
  "require": { "smidgen/php": "*" }
}

Personalized snippets

Open a project in the dashboard for copy-paste configs with your real project ID, API URL, and allowed origin.