Business Modules: Booking, TruCommerce and TruPayments

The bundled modules are the best worked examples of the plugin system. This page summarises what each one does and which core hooks it uses, so you can read the real code with a map in hand.

In the user guide: the TruPayments, Booking, TruCommerce and Payment Gateway Add-ons chapters.

Module overview

ModuleAliasPriorityRequiresProtectedPublic paths
TruPaymentstrupayments100—yespayments
TruCommercetrucommerce99trupayments ^1.0yesshop
Bookingbooking1000trupayments ^1.0yesbooking
Stripe / PayPal / Braintree / Molliestripe …see each module.jsontrupayments ^1.0no—

Protected modules cannot be deleted from the Plugin Manager. "payments": true in module.json marks a module as a payment consumer (Module::paymentModules()).

Anatomy they all share

  1. A {Name}ServiceProvider extending Nwidart\Modules\Support\ModuleServiceProvider, with child providers for routes and events.
  2. A RouteServiceProvider that wraps each route file in web + the right theme middleware (admin: auth, AdminTheme, usually permission:access {module}; public: FrontTheme).
  3. An AdminBooting listener that calls three helpers: {Name}Menu::register(), {Name}Settings::register() and {Name}BuilderMenu::register().
  4. In boot(): translations, breadcrumbs, dashboard rows, front widgets, AppPages definitions, cache-invalidation listeners, Blade components, shortcodes and binding sources.
  5. Seeders for roles/permissions and defaults, template-library seeders, and optional demo seeders.

TruPayments — the payment hub

Guides: Payments and gateways.

Gateway add-ons

Stripe, PayPal, Braintree and Mollie are the template for a minimal plugin: no migrations, one service provider, a settings registration, a gateway class and optionally a Blade request view. They call GatewaySettings::registerGateway('stripe', [...]) and Vanilo\Payment\PaymentGateways::register($id, GatewayClass::class) and implement TruPaymentsGateway / ConfigurableGateway. Credentials live in module-specific settings (sandbox/live sets); the webhook URL is displayed in the settings screen.

TruCommerce — shop and POS

Booking — appointments

Cross-module conventions worth copying