Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Medusa Api Client Laravel Package

gracious/medusa-api-client

A Laravel/PHP client for the Medusa commerce API, giving your application a clean, fluent way to query products, carts, orders, and customers. It wraps Medusa's REST endpoints behind familiar PHP methods, so you can integrate headless storefronts and backend services without hand-rolling HTTP calls.

View on GitHub
Deep Wiki
Context7

Getting Started

This is a Symfony bundle, not a Laravel package — the v0.1.2 notes reference AbstractBundle::loadExtension() and HttpKernel\DependencyInjection\Extension, so there is no Laravel service provider and no package discovery. Read composer.json first: confirm type, the symfony/* constraints (now ^6.4|^7.0|^8.0), and your PHP floor before assuming it drops into a Laravel app.

  • Laravel: you get value from the underlying client/DTO layer, not the bundle. composer require it, then register the client yourself as a singleton in a service provider, pulling base_url / API key from config/services.php + .env. Run composer dump-autoload -o and check for stray Symfony DependencyInjection classes being autoloaded — they'll fail outside a Symfony kernel.
  • Symfony: add the bundle to config/bundles.php, then create config/packages/gracious_medusa_api_client.yaml. Confirm the config root key against the bundle class — since the extension class was removed in v0.1.2, the alias now derives from the bundle, and it may not match what older docs show.
  • First use case: fetch a product/cart from Medusa and hydrate a DTO. Hit bin/console debug:config <alias> (Symfony) or app()->make(Client::class) (Laravel) to confirm wiring before writing anything real.

Implementation Patterns

  • Bind, don't new. In Laravel, bind the client (or a thin MedusaGateway wrapper around it) as a singleton using $this->app->singleton(...) with config-driven credentials. In Symfony, autowiring handles it — just type-hint the client interface in your constructor.
  • Wrap behind your own interface. Because v0.1.2 reshuffled the DI layer, keep application code depending on your CatalogGateway interface, not directly on the bundle's service IDs. Swapping implementations or upgrading becomes a one-line container change.
  • Config as data, not code. Put base_url, publishable/secret key, and timeouts in env vars. Never read them inside the client at call time — resolve once at container build so tests can override.
  • Testing. In Laravel, Http::fake() at the transport layer if the client uses Guzzle/PSR-18 under the hood; otherwise bind a fake implementation of your gateway interface. In Symfony, KernelTestCase + static::getContainer()->set(Client::class, $fake).
  • Async work. Medusa calls are I/O-bound; wrap catalog reads in queued jobs with retry/backoff and cache read-heavy endpoints (Cache::remember / cache.app) rather than calling per-request.
  • Decorator as the extension point. With GraciousMedusaApiClientExtension gone, extend behaviour by decorating the client service (Symfony decorates:) or wrapping it in Laravel — not by subclassing bundle internals.

Gotchas and Tips

  • The removed extension class is the main BC risk. v0.1.2 deletes GraciousMedusaApiClientExtension. If you referenced it in a compiler pass, $container->registerExtension(), a custom kernel, or a KernelTestCase, that code breaks silently at build time (class not found) rather than at runtime. Grep your src/, tests/, and any services.yaml for the class name before bumping.
  • Config alias may have shifted. Under AbstractBundle::loadExtension(), the extension alias is inferred from the bundle name. If your YAML root key now produces "unrecognized option" errors, that's why — check with debug:config and not the old docs.
  • ^8.0 in the constraint ≠ "tested on 8.0". The release merely allows Symfony 8; Symfony 8 requires PHP 8.4. If you're on 8.2/8.3, Composer will resolve you back to 7.x — which is fine, but don't assume 8.0 behaviour.
  • On Symfony 6.4 you were getting deprecations from the old Extension base class. Those are now gone — but that also means you lose the deprecation as a migration signal; audit your container config on upgrade rather than waiting for a warning.
  • Pre-1.0 versioning. At 0.1.x, minor bumps can carry breaks (this one did). Pin ~0.1.2 or commit the lockfile; don't float on ^0.1.
  • Debugging commands worth memorising: bin/console debug:container --show-private, debug:autowiring medusa, debug:config <alias>. In Laravel, php artisan tinker + app()->make(...) and php artisan about to confirm no phantom Symfony service providers.
  • No Laravel auto-discovery, no vendor:publish. If you expected a config file in config/, you'll need to copy the bundle's YAML defaults manually into your own config array.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
frankyso/ipaymu
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core