Lunar PHP Documentation

website·Indexed 32 days ago

https://docs.lunarphp.com/1.x/getting-started/overview/introduction

A headless e-commerce package for Laravel providing a comprehensive catalog, cart, and checkout flow. Includes a Filament-based admin panel, support for payment integrations like Stripe, PayPal, and Opayo, and extensible systems for shipping, taxation, and search.

Tokens
86.2K
Snippets
428
Records
568
Agent score
62%

What's inside Lunar

  1. Overview of Laravel Lunar e-commerce package

    Lunar is a headless e-commerce package for Laravel that provides the backend logic for online stores (products, carts, orders, payments, discounts, and taxation) while allowing developers complete ownership of the codebase, data, and storefront. Because it is a Laravel package rather than a standalone application, it integrates directly into any Laravel project without requiring external APIs or separate system maintenance.
  2. Overview of Lunar Payment Architecture

    Lunar employs a driver-based payment system managed via the Payments facade. The architecture consists of three layers:

    1. Payment Manager (Lunar\Facades\Payments): Routes calls to the active driver.
    2. Payment Type (e.g., Lunar\Stripe\StripePaymentType): Implements provider-specific logic for authorization, capture, and refunds.
    3. Transactions (Lunar\Models\Transaction): Persistent records of payment events linked to orders.
  3. Overview of Media Management in Lunar

    Lunar uses the laravel-medialibrary package by Spatie to handle media across models. It extends this functionality with configurable media definitions, automatic image conversions, and a primary image management system. Most models support media via the Lunar\Base\Traits\HasMedia trait.
  4. Overview of StorefrontSession facade

    The StorefrontSession facade manages session-bound resources required by a storefront, including the active channel, currency, customer, and customer groups. When the facade is first resolved, it automatically initializes these resources (initChannel(), initCustomerGroups(), initCurrency(), and initCustomer()) to restore previously set session values or apply defaults.
    use Lunar\Facades\StorefrontSession;
  5. Overview of Lunar SEO URLs

    Lunar provides a polymorphic URL system to create SEO-friendly slugs for models (e.g., /products/apple-iphone instead of /products/1). Each URL is associated with a specific language, and each model can have one default URL per language. These are lookup mechanisms for storefront routing and are not Laravel route definitions.
  6. Overview of Lunar Search indexing

    Lunar uses Laravel Scout to provide a flexible, driver-based search system. While the database driver is available for basic search, advanced engines like Meilisearch and Typesense are supported for features such as faceted filtering and relevance tuning. All search configuration is managed in config/lunar/search.php.
  7. Overview of Lunar Admin Panel features

    Lunar's admin panel is built on Filament and provides a comprehensive interface for managing e-commerce operations. Key management capabilities include:

    • Products: Handling variants, pricing, images, and associations.
    • Collections: Organizing products into collection groups.
    • Orders: Full lifecycle management of customer orders.
    • Customers: Managing customer profiles and customer groups.
    • Discounts: Creating flexible conditions and rewards.
    • Settings: Configuring channels, languages, currencies, taxes, and tags.
  8. Overview of the Inertia + Vue Starter Kit

    The Inertia + Vue Starter Kit is a production-ready storefront foundation for LunarPHP. It is built using Laravel, Inertia.js, and Vue 3, allowing developers to create a single-page application (SPA) experience while utilizing Laravel's server-side routing and controllers. Unlike the Livewire Starter Kit, this version provides a fully realized front-end experience designed for production stores.
  9. Overview of Lunar 2.0 Alpha features

    v2-0-0-alpha

    Lunar 2.0 introduces a significant restructuring of the core and a new admin panel. Key architectural changes include:

    • Fulfilments: Orders are now managed via dedicated fulfilment records including methods, carriers, and tracking.
    • Inventory: Stock tracking is now per-variant and per-location, supporting movements, reservations, and reconciliation.
    • Regions: A new grouping mechanism for channels, currencies, languages, and tax behaviors for specific markets.
    • Storefront Context: Pricing and availability are now driven by a single session-backed context.
    • Pricing Engine: Implementation of a fluent pricing API and a dedicated PriceValue type.
    • Extension Model: Core logic is moved to the Lunar\Core\... namespace, utilizing swappable action contracts for model verb methods and container bindings instead of config-based class substitution.
  10. Overview of Lunar Attributes

    Attributes allow you to store custom, translatable data against Eloquent models (such as Products, Collections, and Customers). They are organized into Attribute Groups for logical collection and display purposes (e.g., an 'SEO' group containing 'Meta Title' and 'Meta Description').
  11. Overview of Lunar Taxation

    Lunar provides a configurable manual tax rule system to calculate sales tax on orders. For highly complex taxation scenarios, such as US state taxes, it is recommended to integrate with an external service like TaxJar. Custom tax drivers can be implemented to extend the standard calculation logic.
  12. Core features introduced in Lunar v2.0.0

    Lunar v2.0.0 serves as the foundational release introducing several breaking changes and new core concepts to improve performance and extensibility:

    • Reworked custom attributes
    • A dedicated pricing engine with improved price field performance
    • Cart performance optimizations
    • New core concepts: regions and storefront context
    • Core support for fulfilments and per-location inventory
    • A cleaner extension model based on native Laravel seams