Download the PHP package justinholtweb/craft-headcount without Composer

On this page you can find all versions of the php package justinholtweb/craft-headcount. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package craft-headcount

Headcount for Craft CMS 5

Full-featured membership and subscription management plugin for Craft CMS 5. Stripe and PayPal integration, tiered access control, content gating, drip content, and a complete subscription lifecycle -- built for the Craft ecosystem.

Features

Requirements

Installation

Or install from the Craft Plugin Store.

Quick Start

1. Configure Payment Gateways

Navigate to Headcount > Settings and enter your Stripe API keys. Optionally enable PayPal.

Settings can be overridden via config/headcount.php:

2. Create Plans

Go to Headcount > Plans and create membership tiers. Each plan maps to:

Plans come in two shapes:

A season plan leaves Repeats Every Year on by default, so the window rolls forward on its own once it finishes and next season starts selling without anyone editing the plan. Turn it off for a one-off season, which stops selling once it ends.

Turn on Pro-rata Mid-season Joins to scale the price by how much of the season is left. By months (the default), someone joining in October of a July–June season pays nine twelfths — the whole months they can still use. By days is exact but produces less familiar prices.

Season plans are charged as a one-off Stripe payment rather than a subscription, so they have no stored Stripe Price and nothing to renew. They can't be paid for with PayPal, whose Subscriptions API can only bill on a cycle; checkout refuses a PayPal season purchase rather than quietly signing the member up to something recurring.

Expiry is not automatic on its own — run headcount/subscriptions/expire daily (see CLI Commands).

3. Set Up Webhooks

Point your Stripe webhook to:

Required Stripe events:

For PayPal:

4. Create Access Rules

Go to Headcount > Access Rules to gate content. Each rule picks what it applies to from a single Applies To menu, grouped by element type -- all entries, a section, an entry type, entries related to a category, or one specific entry. Other plugins can add their own element types to that menu (the Showtime bundle adds Owl events, scoped by calendar), so gating isn't limited to entries.

Choose a behavior:

Behavior Effect
Redirect 302 redirect to login or pricing page
Paywall Page still renders; your template shows a teaser -- see below
Hide Return 404 for unauthorized users

Redirect and hide are enforced for you. Paywall withholds nothing on its own -- it lets the page render so the template can decide what to show:

If your templates already gate content themselves and you don't want rules applied automatically, turn off Enforce Access Rules in the settings.

5. Add Checkout to Templates

Template Reference

Template Variable: craft.headcount

Twig Tag: {% headcountGate %}

Using Craft's Built-in User Group Checks

Since Headcount syncs subscriptions to Craft user groups, you can also use native Craft checks:

Wallet Cards

Members can add a membership card to Apple Wallet or Google Wallet and show it to prove membership away from the site — at a club shop, a partner offering a members' discount, or the gate.

Both platforms bind a card to the organisation issuing it, so the credentials are yours, not Headcount's: a plugin cannot ship them. You supply them under Headcount → Settings → Wallet Cards, and every field there accepts an environment variable.

What each card shows

The member's name, the plan, the status, and the date the membership runs out — plus a QR code. Scanning it opens a verification page on your own site that answers Valid or Not valid in one word, then the member's name and expiry underneath. That page is deliberately readable by a shop assistant with nothing but a phone camera: no app, no reader hardware, and nothing to install.

Override it by adding your own headcount/wallet/verify.twig to your site's templates directory; it receives valid (bool) and card (the card's fields, or null). Requesting it with Accept: application/json returns the same answer as JSON.

Apple Wallet

From your Apple Developer account you need:

  1. A Pass Type ID (e.g. pass.com.yourclub.membership) registered under Identifiers.
  2. Its certificate, downloaded and then exported from Keychain Access as a .p12.
  3. Apple's WWDR intermediate certificate in .pem form.
  4. Your ten-character team identifier.

Point the settings at the two files — outside your web root — and give the .p12 password as an environment variable. You also need an image directory containing at least icon.png (plus optionally [email protected], logo.png, [email protected]); iOS refuses a pass with no icon.

Keeping cards up to date. Leave Keep Cards Up To Date on and Headcount runs Apple's pass web service: devices register themselves against each pass, and whenever a membership changes, Headcount sends a silent push so the phone re-fetches the card. A membership cancelled in March greys out in the member's wallet without waiting for its expiry date. This needs your site reachable over HTTPS with a valid certificate — devices silently refuse to register otherwise — and PHP built with curl and HTTP/2.

Turn it off and cards are still issued and still carry their expiry date, so a season card stops looking valid on 1 July by itself; only mid-term changes go unnoticed on the device.

Google Wallet

From the Google Pay & Wallet Console:

  1. Create an issuer account and note its numeric issuer ID.
  2. Create a Google Cloud service account with the Wallet Object Issuer role, authorise it in the console, and download its JSON key.

Point the settings at the key file. Google needs no per-device machinery: the card lives on Google's servers, so an update is a single API call that reaches every device the member added it to.

Linking to cards

See the wallet helpers under Template Reference. Each returns null when that platform isn't configured, so a site issuing only Google cards needs no conditional of its own. Admins can also download or open any member's card from the subscription's page in the control panel.

REST API

All endpoints are prefixed with /actions/headcount/api/.

Method Endpoint Auth Description
GET /plans Public List all enabled plans
GET /plan?handle=xxx Public Get a specific plan
GET /subscriptions Session / API key List a member's subscriptions
GET /subscription?id=xxx Session / API key Get a specific subscription
POST /checkout Session Create a checkout session
GET /portal Session Get Stripe Customer Portal URL
GET /member Session / API key Get a member's info with subscriptions

Authentication

Session — a logged-in user's own session. The request always acts for the logged-in user; userId / email parameters are ignored, so one member can never read another's data.

API key — set an API key under Headcount → Settings and send it in the X-Headcount-Api-Key header. It is a single, global, trusted server credential, so it is for server-to-server use only — never ship it to a browser. Requests with no key, or a wrong key, get 401. If no API key is configured, key authentication is off and every non-public endpoint rejects anonymous callers.

Because the key belongs to the server rather than to a member, a key-authenticated request has to say which member it is acting for, with either userId or email:

Situation Response
No key / wrong key on a non-public endpoint 401 Unauthorized
Key present, no userId or email 400 Bad Request
Key present, member doesn't exist 404 Not Found
/subscription?id= that the named member doesn't own 403 Forbidden

POST /checkout and GET /portal act on the current member's own payment session and remain session-only — an API key does not grant access to them.

Breaking in 5.2.0:

  • The ?apiKey= query-parameter fallback has been removed — keys in URLs leak into access logs, browser history, and Referer headers. Move any integration still using it to the X-Headcount-Api-Key header.
  • API-key requests to /subscriptions, /subscription and /member must now pass userId or email. (These previously returned 401 for any session-less caller, so no working key-based integration can exist, but the endpoints are now reachable where before they were not.)
  • POST /checkout now requires a CSRF token, like every other Craft POST action. Front-end JS must send CRAFT_CSRF_TOKEN (or the X-CSRF-Token header).

CLI Commands

Both of the first two want a daily cron entry; nothing schedules them for you.

Events

Headcount fires events you can listen to in custom modules or plugins:

Available events on Subscriptions service:

Outgoing Webhooks

Configure a webhook URL in Headcount > Settings to receive POST notifications for subscription lifecycle events. Payloads are signed with HMAC-SHA256 via the X-Headcount-Signature header.

Events: subscription.created, subscription.updated, subscription.canceled, subscription.expired, member.upgraded, member.downgraded

Architecture

Headcount uses a hybrid architecture:

Database Tables

Table Purpose
headcount_plans Membership plan definitions
headcount_subscriptions Subscription element content (FK to elements)
headcount_access_rules Content gating rules
headcount_drip_schedules Drip content timing
headcount_coupons Discount codes
headcount_webhook_logs Incoming webhook event log (idempotency)
headcount_wallet_registrations Which devices hold which Apple Wallet pass, and where to push updates

Support


All versions of craft-headcount with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
craftcms/cms Version ^5.0
stripe/stripe-php Version ^13.0 || ^14.0 || ^15.0 || ^16.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package justinholtweb/craft-headcount contains the following files

Loading the files please wait ...