Download the PHP package antoniadisio/creem-php without Composer

On this page you can find all versions of the php package antoniadisio/creem-php. 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 creem-php

creem-php

Packagist Version GitHub Tests Action Status GitHub Code Style Action Status Packagist Downloads

Creem PHP SDK

Unofficial but passionate PHP SDK for Creem, with a typed client facade, resource DTOs, credential profiles, and webhook verification helpers.

This is an independently maintained personal package published under the antoniadisio namespace. It is not an official Creem package and is not distributed by Creem.

The public contract centers on a typed Antoniadisio\Creem\Client facade for outbound API access, named credential profile helpers for multi-account integrations, and a stateless Antoniadisio\Creem\Webhook helper for inbound webhook verification and parsing. saloonphp/saloon is used internally for transport only and is not part of the supported consumer-facing API.

Installation

Requires PHP 8.4 or newer. The runtime namespace is Antoniadisio\Creem\.

Release history and migration notes live in the GitHub changelog.

Audience

This README stays consumer-focused. Repository workflow, releases, and live verification procedures live in the linked repo docs.

Everything under Antoniadisio\Creem\Internal\* is shipped for runtime support only and is not part of the supported consumer-facing API.

Quick Start

Product responses expose custom_fields as typed Antoniadisio\Creem\Dto\Common\CustomField objects via $product->customFields.

Antoniadisio\Creem\Config defaults to Environment::Production. If you are using test API keys or test resource IDs, set Environment::Test explicitly. Creem's marketing/docs may also call the test environment "sandbox", but the SDK does not expose a separate sandbox environment.

Configuration

Antoniadisio\Creem\Config is immutable and accepts:

Environments resolve to:

The SDK validates Creem-prefixed keys against the configured environment. creem_test_... keys are only accepted with Environment::Test, and creem_... production keys are only accepted with Environment::Production.

When baseUrl is provided, Config now enforces trusted-host mode by default and only allows official Creem hosts (api.creem.io, test-api.creem.io). To target a non-official host (for example a local proxy), you must opt in explicitly with allowUnsafeBaseUrlOverride: true.

Config also redacts the API key in debug output, string casts, and serialization.

Transport defaults are hardened: redirects are disabled, TLS certificate verification is always enabled, TLS 1.2 is enforced as the minimum protocol, and request/connect/read timeouts all use the configured SDK timeout (or the 30-second default).

Credential Profiles

For first-class multi-account integrations, use named credential profiles instead of trying to overload one Config with multiple API keys or webhook secrets.

Antoniadisio\Creem\CredentialProfile mirrors the Config inputs for one concrete credential set and adds an optional webhookSecret. Antoniadisio\Creem\CredentialProfiles stores named profiles, and Antoniadisio\Creem\ClientFactory lazily builds one Client per profile.

The low-level single-key API remains available when you only need one credential set. The multi-profile layer is the recommended SDK path when you need to route requests or webhooks across multiple Creem accounts or app surfaces.

Error Handling

All SDK exceptions extend Antoniadisio\Creem\Exception\CreemException.

Webhooks

Antoniadisio\Creem\Webhook verifies the incoming creem-signature header against the raw request body and parses the JSON payload without requiring a Client instance. Creem currently sends creem-signature as the raw HMAC digest of the payload, for example 63dcbb00f44e82ac158edfb75fd745286f99e9bcebed04dbc0133bb20d15d09c.

You can also pass an optional replay callback to Webhook::constructEvent(...). The callback receives the parsed WebhookEvent; return true to reject already-seen events:

Always verify the exact raw request body. Do not json_decode(), re-encode, trim, or otherwise mutate the payload before calling Webhook::verifySignature() or Webhook::constructEvent(), or the HMAC check will fail. The SDK also rejects webhook payloads larger than 1 MiB before decoding.

When multiple webhook secrets exist, resolve the intended named profile first and use the profile-aware helpers instead of trying every secret blindly:

Webhook::verifySignatureForProfile(...) and Webhook::constructEventForProfile(...) resolve exactly one secret from the named profile. The SDK does not iterate across every configured secret for you.

For local webhook development and manual dashboard test sends, the maintainer runbook in the GitHub playground guide documents the php -S plus ngrok flow and the per-route/profile verification checklist.

For Laravel-style controllers, use the raw request content instead of decoded request input:

The returned WebhookEvent exposes id(), eventType(), eventTypeEnum(), createdAt(), object(), payload(), and toArray(). eventType() remains the raw string from Creem for forward compatibility, while eventTypeEnum() returns a WebhookEventType for currently documented events or null for unknown future values. object() returns a StructuredObject, so consumers can read nested webhook data without decoding JSON again. Live Creem deliveries currently send created_at as a Unix epoch timestamp; the SDK normalizes that to DateTimeImmutable for you.

Resources

Antoniadisio\Creem\Client exposes these resource accessors:

All mutating resource methods accept an optional final ?string $idempotencyKey = null argument. Pass a stable key on retries to prevent duplicate checkout, subscription, discount, or license side effects.

Mutation request DTOs now fail fast with InvalidArgumentException when required identifiers are blank after trimming, numeric bounds are invalid (for example price <= 0 or units <= 0), discount payload fields are incoherent (fixed vs percentage), or list elements are malformed at runtime. Existing integrations that relied on sending empty/invalid payload values should update those call sites before upgrading.

Mutating resource methods that interpolate IDs into path segments (subscriptions()->cancel/update/upgrade/pause/resume and discounts()->delete) now normalize IDs and reject unsafe input. IDs are trimmed, must be non-blank, may not be dot segments (. or ..), and may only contain [A-Za-z0-9._-]; reserved URI/control characters (/, \\, ?, #, %, ASCII controls) are rejected to prevent route manipulation.

Products

Supported methods:

Customers

Supported methods:

Subscriptions

Supported methods:

For live seat updates, prefer priceId on UpsertSubscriptionItem and pass the current subscription item id when adjusting an existing line item. Creem's API troubleshooting guidance recommends price_id as the most specific reference for validation. When setting updateBehavior on subscriptions()->update(...), SubscriptionUpdateBehavior::ProrationChargeImmediately applies the unit change immediately and may generate a proration charge right away. In live testing, SubscriptionUpdateBehavior::ProrationCharge and SubscriptionUpdateBehavior::ProrationNone left the current item units unchanged until the next billing boundary.

Checkouts

Supported methods:

Licenses

Supported methods:

Discounts

Supported methods:

Transactions

Supported methods:

Stats

Supported methods:

Response Shapes

Collection-style endpoints return Antoniadisio\Creem\Dto\Common\Page, with pagination metadata in Antoniadisio\Creem\Dto\Common\Pagination. Resource items are exposed through typed DTO payloads instead of raw decoded arrays.

Closed-set response fields are hydrated to Antoniadisio\Creem\Enum\* cases, spec-defined date-time fields are hydrated to DateTimeImmutable, and malformed required payloads now raise Antoniadisio\Creem\Exception\HydrationException instead of being silently coerced.


All versions of creem-php with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
ext-hash Version *
ext-json Version *
saloonphp/saloon Version ^3.15
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 antoniadisio/creem-php contains the following files

Loading the files please wait ...