rapidez/core
Rapidez core provides the Laravel foundation for fast, headless Magento storefronts, including routing, product and category views, search, cart, checkout, and configurable Vue/Tailwind frontend components.
Rapidez is a Laravel package that turns a Magento 2 GraphQL backend into a headless storefront. rapidez/core is the backend half: the GraphQL client, URL/route resolution, model layer, caching, Blade/Vue scaffolding and config. The frontend theme (rapidez/checkout-theme, rapidez/account, etc.) is layered on top.
Minimum steps:
composer require rapidez/core
.env:
MAGENTO_BASE_URL=https://magento.test/
MAGENTO_STORE=nl
Confirm GraphQL actually answers before debugging Rapidez: curl -X POST $MAGENTO_BASE_URL/graphql -H 'Content-Type: application/json' -d '{"query":"{storeConfig{store_name}}"}'.php artisan vendor:publish --tag=rapidez-config
php artisan vendor:publish --tag=rapidez-views
php artisan rapidez:install # if available in your version
config/rapidez.php — routes, cache, image config, model map, attribute lists. Almost every "why does it behave like that" question ends here.routes/frontend.php (package routes) — you will see the catch-all slug route early; understand it before adding routes.src/Rapidez.php and the facade — the public API you'll call daily.resources/views/ — the Blade components (<x-rapidez::…>) and layout.resources/js/ — Vue components registered globally; the place to extend behaviour./{url_key} for a known product and confirm: URL rewrite resolves, GraphQL product query returns data, images render, add-to-cart hits the Magento GraphQL addSimpleProductsToCart mutation. If that loop works, the majority of your config is correct.Expect the core package to be pinned tightly to a specific theme/frontend version. Treat a Rapidez upgrade as an upgrade of core + theme + any rapidez/* addons together, not core alone.
GraphQL is your data layer — call it through the facade, not raw HTTP. The package wraps the Magento endpoint, injects store/locale headers, and caches responses:
use Rapidez\Core\Facades\Rapidez;
$result = Rapidez::graphql(<<<'GRAPHQL'
query Product($sku: String!) {
products(filter: { sku: { eq: $sku } }) {
items { name sku price_range { minimum_price { final_price { value } } } }
}
}
GRAPHQL, ['sku' => $sku]);
$product = $result['products']['items'][0] ?? null;
Use this instead of Http::post(...) everywhere — you get the store header, error handling, and cache integration for free. Build a small repository/service class per feature (product, category, CMS block) that wraps these queries and returns plain arrays; this keeps Blade and Vue components dumb.
Model resolution via config, not hardcoding. Rapidez resolves "models" (product, category, customer, cart) through a class map in config/rapidez.php. Day-to-day you either:
Rapidez::getModel('product') / Rapidez::model('product') (name varies by version — check src/Rapidez.php), andRoute model binding and the catch-all slug route. The frontend relies on Magento URL rewrites: a single catch-all route receives /{slug} and resolves the rewrite to a product, category or CMS page. Practical consequences:
Views: Blade components + Vue islands. The pattern is server-rendered Blade that mounts Vue components for interactivity (cart, search, add-to-cart). Follow it:
<x-rapidez::product.price :product="$product" />
<add-to-cart :product="@js($product)" />
Override published views in resources/views/vendor/rapidez/.... Prefer publishing and overriding over view()->addNamespace() hacks, and never edit vendor/rapidez/core/resources — you'll lose it on composer update.
Caching is a first-class concern. GraphQL reads go through Laravel's cache. The workflow that works:
Integration tips that pay off:
src attributes are the usual source of broken thumbnails on staging.Http::fake(['*/graphql' => Http::response([...])]). Because everything funnels through the facade, you can feature-test the storefront without Magento running.npm run dev for the frontend with the Laravel server pointed at the remote GraphQL. A Vite/Mix asset build is required for anything beyond localhost — a "blank page / no styles" issue is nearly always a missing build or a stale manifest.errors array; a naive $result['products']['items'] then throws on null. Log the errors key in your repository layer and return a sane default, otherwise you debug a 500 in Blade instead of the actual Magento message.php artisan route:clear).php artisan config:cache cleared. In production, editing config/rapidez.php without re-caching gives you stale store codes, stale cache TTLs and stale model bindings.composer update rapidez/core alone will break the frontend. Core, theme and addons share Blade component names and Vue props. Pin them to compatible minor versions and read the changelog for renamed x-rapidez:: components before upgrading.vendor/. Publish the view or config, override, and re-run php artisan view:clear. Vendor edits vanish silently on the next deploy and produce "works on my machine" ghosts.@js($data) is the safe way to pass arrays; hand-written {{ json_encode(...) }} inside an attribute breaks on quotes. Hydration mismatches usually trace back to Blade rendering different data than the API returns — keep the server payload as the single source of truth.base_media_url from storeConfig. If images work in Magento but 404 in Rapidez, compare that value against MAGENTO_BASE_URL (trailing slash and subdirectory installs are common culprits).Int vs String for SKU/ID) or a cache key collision, not Laravel.git log -p on the file you're fighting.How can I help you explore Laravel packages today?