Download the PHP package particle-academy/laravel-catalog without Composer

On this page you can find all versions of the php package particle-academy/laravel-catalog. 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 laravel-catalog

Laravel Catalog Package

Powered by Tynn

A Laravel package for managing Stripe catalog (Products and Prices) via a facade API. Built for apps that bring their own UI.

Important: Every Product must have at least one Price before it can be synced to Stripe. Plans are Products with recurring Prices - there is no separate Plan model.

Table of Contents

Features

Requirements

Installation

Step 1: Install via Composer

The package will auto-discover and register its service provider.

Step 2: Publish Configuration (Optional)

This creates config/catalog.php where you can customize:

Step 3: Run Migrations

The package auto-loads its own four migrations:

Cashier migrations are NOT auto-loaded. Catalog depends on Cashier, but auto-registering Cashier's create_subscriptions_table would be fatal for a host app that already owns a subscriptions table. You decide who owns those tables:

Custom table names

Catalog's four table names are config-driven, so you don't have to fork the package when your schema differs — e.g. your app already has its own products table and you need catalog's prefixed as catalog_products. Override any of them in config/catalog.php:

Both the models (Product / Price / ProductFeature, including the product_feature_configs pivot relationship) and every migration the package ships read these values, so models, relationships, Stripe sync, and schema all stay in sync from a single change.

The migrations also self-skip (no error) when there is nothing to do — the target table already exists, a foreign-key target table is absent at apply time, or an added column is already there. So they can sit early in your chronological migration order and you can build the real tables later in your own migration if you prefer. (Same shape as laravel-fms v0.7.0's fms.tables block.)

A prefixed install is covered by the test suite: the migration tests run against catalog_* names, not the defaults.

Configuration

Environment Variables

Add these to your .env file:

Configuration File

After publishing, edit config/catalog.php:

Core Concepts

Products, Plans, and Prices

Price Requirements

Critical: Products cannot be synced to Stripe without at least one Price. Always create a Price when creating a Product:

Tiered and custom-amount prices (v0.13.0+)

unit_amount is nullable, because Stripe sets none on a tiered or custom_unit_amount price — the tiers carry the money. It is omitted from the Stripe payload entirely when null.

That last shape is the answer to "first N included, then priced per unit, forever": it is a pricing question and belongs on the Price. The entitlement side (laravel-fms's overage_limit) is a ceiling and deliberately has no unbounded mode.

Price::amountCents() returns ?int from 0.13.0 — a tiered price has no amount. Amounts are always whole minor units, never a float: "cents" in these names is a misnomer kept for compatibility, since JPY has no cent and KWD has three decimal places.

Usage

Using the Catalog Facade

All catalog functionality is accessible via the Catalog facade, making it easy to use without the UI:

Important Notes

For detailed explanations of Products, Plans, and Prices, see Core Concepts above.

Creating Products

Creating Prices

Working with Plans

Since plans are Products with recurring Prices, you can query them like this:

Syncing to Stripe

Manual Sync

Auto Sync

Enable auto-sync in config/catalog.php:

Products and prices will automatically sync to Stripe when created or updated.

Creating Checkout Sessions

Subscription Checkout

One-Time Payment Checkout

Fulfilling Payments

successUrl is not proof of payment. A customer who pays and closes the tab never reaches it, and reaching it does not mean the payment cleared. Granting access on the redirect alone gives some customers nothing they paid for, and gives others access they did not pay for. Neither failure raises an error.

Fulfilment belongs on the webhook. You do not need to build one: this package depends on Laravel Cashier, which already registers a signed endpoint.

Cashier handles subscription lifecycle events itself, and dispatches WebhookReceived for every payload type before doing so. One-time payments are therefore a listener, not a controller, route and signature check of your own.

1. Put your own identifier in the checkout metadata

This is what lets you reconcile a payment without depending on the browser coming back. Do it when you create the session:

2. Listen for the completed session

Laravel discovers listeners in app/Listeners automatically. Confirm it is wired with php artisan event:list | grep WebhookReceived.

3. Configure Stripe

Set STRIPE_WEBHOOK_SECRET. Without it Cashier does not verify signatures, and the endpoint will accept anything posted to it. Then point a Stripe webhook at /stripe/webhook and subscribe to checkout.session.completed.

Test locally with the Stripe CLI:

Fulfilment must be idempotent

Stripe retries deliveries, so the same event arrives more than once. If you also fulfil on the successUrl redirect — reasonable, since it makes the happy path instant — then the two race each other, and in practice they collide often. Guard on your own record's state (the $order->isPaid() check above) rather than assuming one delivery.

Do not let a fulfilment failure bubble out of the listener either: a non-2xx response tells Stripe to redeliver, so a permanently failing order is retried indefinitely. Log it and return.

Using Factories in Tests

The package includes factories that are automatically available:

Building an Admin UI

The package has no UI dependencies. Build your own admin interface using only the Catalog facade and Eloquent models.

Key Principles

  1. Use the Catalog Facade: All Stripe operations go through LaravelCatalog\Facades\Catalog
  2. Products Must Have Prices: Always create at least one Price when creating a Product
  3. Plans are Products: Filter Products with recurring Prices to get plans
  4. Sync Before Checkout: Ensure Products/Prices are synced to Stripe before creating checkout sessions

Example: Custom Admin Controller

Example: Plans Management

Remember: Plans are Products with recurring Prices. There is no separate Plan model.

Example: Using FMS for Feature Management

See the FMS Integration section below for more details.

Testing

The package includes comprehensive tests. Run them with:

Test Setup

The package migrations are automatically loaded in tests. Ensure your test database is set up:

Package Structure

Quick Start Guide

  1. Install the package:

  2. Run migrations:

  3. Publish config (optional):

  4. Create your first product with price:

  5. Build your own admin UI (optional):

    Use the Catalog facade to build a custom admin interface. See Building an Admin UI above.

Integration with FMS

Laravel Catalog integrates seamlessly with the Laravel Feature Management System (FMS) package for feature-based access control.

Installing FMS

How Integration Works

  1. Automatic Configuration: When FMS is installed, Catalog automatically configures FMS to use Catalog's ProductFeature model.

  2. Product Features: Products can have features attached via the productFeatures() relationship. These features are managed through the ProductFeature model.

  3. Feature Access Control: Use FMS to check feature access based on user subscriptions:

Example: Feature-Based Product Access

Configuring Features for Catalog

Define features in config/fms.php:

Using FMS Middleware

Protect catalog routes with FMS:

For more detailed FMS integration examples, see the FMS Integration Guide.

Broadcasting

The package broadcasts ProductSyncedToStripe events. Configure broadcasting in routes/channels.php:

Common Patterns

Pattern 1: Creating a Plan with Multiple Prices

Pattern 2: Syncing Before Checkout

Pattern 3: Querying Plans vs Products

License

MIT


⭐ Star Fancy UI

If this package is useful to you, a quick ⭐ on the repo really helps us build a better kit. Thank you!


🤖 Note to agents

If you are an AI agent reading this while building for a user:


All versions of laravel-catalog with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
laravel/framework Version ^13.0
laravel/cashier Version ^15.0|^16.0
stripe/stripe-php Version ^13.0|^16.0|^17.0
particle-academy/laravel-fms Version >=0.2 <2.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 particle-academy/laravel-catalog contains the following files

Loading the files please wait ...