Skip to content

Expert Answers to Your Magento, Shopify & Shopware Questions

Vendor-neutral, engineer-written explanations. Clear definitions first, then practical steps with real examples — no fluff.

Stagebit builds and maintains stores on Magento, Adobe Commerce, Shopify, Shopware, and Laravel, and this library holds the questions our own engineers get asked most often on each platform.

Laravel

Laravel Answers

Laravel questions from two kinds of work: building multi-tenant SaaS products, and building the integration layer between applications and the business systems around them. This library covers tenancy architecture and tenant isolation, subscription billing and entitlements, EU VAT on digital services, integrating with Magento, Adobe Commerce, Shopware and Shopify, ERP and PIM middleware that survives failures, and queue architecture under real load. Answers come from Stagebit engineers building and maintaining both. Where a platform or an off-the-shelf tool would serve you better than custom Laravel, we say so.

Fit and architecture decisions

  • Build custom in Laravel when your core business logic doesn’t fit a platform’s data model, when platform customization would mean fighting the architecture rather than working with it, or when the software itself is your product rather than a supporting tool. Extend an existing platform like Shopify, Magento, or Shopware instead when your requirements are close to standard e-commerce or CMS workflows, since configuration and targeted extensions get you to market faster and cheaper than a custom build. The deciding factor is how far your requirements diverge from what the platform already assumes, not a general preference for custom code.
  • Don’t build eCommerce in Laravel when you need a store live fast on a limited budget, when your requirements are standard catalog and checkout flows with no unusual business logic, when you lack an in-house team to maintain custom code long-term, or when PCI compliance and payment processing need to be handled by the platform rather than by you. In those situations, a platform like Shopify, Magento, or Shopware gets you further, faster, at lower total cost. Laravel earns its place when the store’s logic genuinely can’t fit a platform’s data model, not as a default choice for every store.
  • Laravel is a strong fit for a SaaS product when you want to ship an MVP quickly with a small team, since it ships with queues and job handling out of the box and has official first-party packages for subscription billing (Cashier) and API authentication (Sanctum), so you’re not building that infrastructure from scratch. It’s a weaker fit for SaaS products with extremely high concurrency or real-time, socket-heavy workloads, where stacks built around asynchronous I/O, like Node.js or Elixir, have a structural advantage. For most subscription-based, CRUD-heavy SaaS products, that structural advantage rarely outweighs Laravel’s faster path to a working product.
  • Build multi-tenant from day one only if you already know you’ll have many customers on a shared codebase and can commit engineering time to tenant isolation up front. If you’re still validating the product or expect a handful of customers in year one, start single-tenant and design your data layer so tenancy can be added later without a full rewrite. Retrofitting multi-tenancy after launch is possible but touches nearly every query in the application, so the deciding factor is how confident you are in the growth assumption, not a general best practice either way.
  • Keep simple persistence in the store action or controller. Move integration logic into a dedicated service once it involves an external API, authentication, retries, or response mapping. The store action should coordinate the request; the integration service should handle communication with the outside system. Add a queued job on top once the integration is slow enough that it shouldn’t block the response.
  • Build custom Laravel code when the integration logic is tied to your own business rules, something a platform’s visual editor can’t safely model. Reach for a platform like Zapier, Make, or Workato when you’re connecting several third-party tools, workflows change often, or non-developers need to maintain them. Integration count is one factor here, not a fixed cutoff, logic complexity and who owns maintenance matter just as much.
  • A Laravel service layer around an existing system is a set of PHP classes, one per domain area. A thin controller calls the service, which reaches the legacy API, SOAP client, or database through an adapter or repository. DTOs carry typed data in, and an interface is worth adding only where an implementation must be swappable.

APIs webhooks and integration fundamentals

  • For idempotent webhook processing in Laravel, verify the signature, then insert the provider’s event ID into a table with a unique index on provider and event_id. If the insert throws UniqueConstraintViolationException, return 200 and stop. Otherwise, queue a job that skips events with processed_at set and writes its changes inside one transaction. For Stripe, use the event id, and for Shopify, use the X-Shopify-Webhook-Id header.
  • To verify incoming webhooks in Laravel, compute an HMAC of the raw body and compare it to the signature header, or use the sender’s official SDK. Serve the route over HTTPS, exclude it from CSRF protection, and ignore event IDs you have already processed. Then validate the event against your own records, rate limit the route, and return a 2xx response before processing the payload in a queued job. The spatie/laravel-webhook-client package covers signature checks, payload storage, and queuing for senders that sign the request body with HMAC.

ERP PIM and WMS and CRM middleware

  • In Laravel, save each order and an outbox row in the same database transaction, then dispatch a queued job after the commit. Have the job send the order to the ERP with a stable idempotency key, so retries never create duplicates. Retry temporary errors with backoff, and flag permanent ones for review on the outbox row. A scheduled command then re-sends anything still unconfirmed.
  • To stop Laravel sync failures going unnoticed, run each sync as its own queued job with finite Tries and Backoff. Never swallow exceptions in handle(), record terminal failures in failed(), and alert from a Queue::failing listener. Then monitor queue depth and add scheduled reconciliation, because failed_jobs cannot see a sync that was deleted or never queued.
  • Reconciliation takes seven steps. Set a source-of-truth rule per field, match records on a shared key, diff both sides into missing, orphaned and conflicting records, review the dry-run report, apply idempotent (safe to run twice) fixes in batches, verify each result, then schedule the same diff in report-only mode. Drift then shows up as a short report you can read in minutes. Fix the cause too, usually a failed job, a dropped webhook or a manual edit on the wrong side.

Integrating Laravel with commerce platforms

  • Keep one rule: the commerce platform calculates, Laravel relays. Call the platform’s official API through a single gateway class. Reshape responses with Laravel API Resources, cache reads with a short TTL and forward every write to the platform. Store a local copy only for data you must query yourself, and refresh it with webhooks plus a scheduled reconciliation job.

B2B portals dashboards and admin tools

  • Build a standalone Laravel B2B customer portal for buyers and leave products, prices and orders in the existing store. Keep the B2B data the store lacks in the Laravel database: companies, buyer roles, approvals and quotes. Run store API calls through queued jobs, verify webhook signatures, and send finished orders to the store instead of creating a second order record. Check the store’s native B2B features first, because Shopify and Adobe Commerce both offer them.

Multi-tenancy and SaaS architecture

  • Move to database-per-tenant in Laravel when a concrete requirement forces it. The four that qualify are contractual data isolation, per-tenant backup and restore, one tenant dominating database load, and per-tenant schema control. Tenant count alone is not a trigger. Without one of the four, stay on a shared database with tested tenant scoping, because the move adds provisioning, migration, and reporting work.
  • Laravel tenant isolation has three common models: a database per tenant, a shared PostgreSQL database with row-level security, or a shared database with Eloquent global scopes alone. The first two survive a forgotten where() clause, provided the request selects the right tenant and the database role cannot bypass the isolation; the third does not. In all three, make queues, cache and file storage tenant-aware. Then test with two tenants that try to read each other’s data.
  • To prove tenant isolation in a Laravel app, show the customer how tenant context is established and enforced. Then run cross-tenant tests that try to break it and share a dated CI report. Depending on your architecture and the customer’s security requirements, add database-level controls, an audit trail, and an independent penetration test. No single artifact proves isolation alone.
  • Store the tenant ID in the job, restore that tenant before any tenant-specific code runs, and reset it when the job ends. Laravel’s Context facade can carry the ID from dispatch to worker, but it does not switch databases, cache prefixes, or query scopes. Your own code, or a package such as stancl/tenancy or spatie/laravel-multitenancy, has to do that. Test by running Tenant A, Tenant B, and a central job back to back on one worker.

Subscriptions billing and entitlements

  • Treat Stripe as the source of truth for billing facts, and let Laravel apply your access rules through one check. Simple apps can call Cashier’s subscribed method directly, while complex apps can derive a rebuildable entitlements table. Verify webhook signatures, return a 2xx quickly, and do the real work in a queued job that re-reads the subscription from Stripe. Add a scheduled reconciliation job to catch events that arrive out of order or never arrive.

SaaS compliance tax and data protection

  • EU VAT on SaaS subscriptions is generally charged at the customer’s country rate on cross-border sales to consumers and reverse-charged on sales to taxable businesses acting as such. Sellers can report consumer VAT through one optional quarterly One Stop Shop (OSS) return. EU-established sellers at or below €10,000 in cross-border consumer sales in the current and previous calendar year can charge home-country VAT, while sellers outside the EU have no threshold. In Laravel, Cashier with Stripe Tax calculates the tax, but registration, filing and payment are separate tasks, and Paddle can handle them as merchant of record.

Queues jobs and reliability

  • A Laravel queue stores jobs in a backend such as a database, Redis, Amazon SQS, or Beanstalkd. A worker started with php artisan queue:work takes each job and runs its handle method outside the web request. The sync driver is the exception, because it runs jobs immediately in the current process. Queues suit slow, retryable work such as email, API calls, and file imports.