Weave Code
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
Bagisto Api

Bagisto Api Laravel Package

bagisto/bagisto-api

REST and GraphQL API layer for Bagisto 2.3.8+, built on API Platform. Quickly install via Composer and an Artisan installer to get API docs, GraphQL Playground, and shop/admin endpoints for e‑commerce integrations and extensions.

View on GitHub
Deep Wiki
Context7

At a glance

Frequently asked questions about Bagisto Api
What Laravel and PHP versions does bagisto/bagisto-api support?
The package requires **Laravel 10+** and **PHP 8.3+**, with strict compatibility tested against Bagisto **v2.3.8+**. API Platform dependencies are pinned to specific versions (e.g., `api-platform/laravel:v4.1.25`) to ensure stability. Always check the [GitHub repo](https://github.com/bagisto/bagisto-api) for updates on supported versions.
How do I install bagisto-api in an existing Bagisto project?
Run `composer require bagisto/bagisto-api` followed by `php artisan bagisto-api-platform:install`. This auto-configures API Platform, generates docs, and sets up GraphQL Playground. For manual control, register the service provider and update `composer.json` autoloading, then install pinned API Platform packages explicitly.
Can I use this package without Bagisto? Or is it strictly tied to Bagisto’s core?
This package is **Bagisto-specific** and assumes Bagisto’s database schema, models, and business logic (e.g., product variants, bookings). If you need a generic Laravel API layer, consider alternatives like `spatie/laravel-api-resources` or `api-platform/laravel`. For Bagisto, this is the official API solution.
What’s the difference between the shop and admin APIs? How are they secured?
The **shop API** uses a `STOREFRONT_KEY` (JWT-like) with rate limiting (default: 100 requests/minute) and caching (TTL configurable). The **admin API** requires token-based auth with RBAC, IP whitelisting, and audit logs. Both are separated by endpoints (`/api/shop/` vs `/api/admin/`).
Does this package support GraphQL? How do I test queries?
Yes, it includes **GraphQL Playground** at `/api/graphiql` (shop) and `/api/admin/graphiql` (admin). Use schema-first development with API Platform’s Hydra metadata. Test queries like `{ products { id name variants { sku } } }`—documentation is auto-generated via OpenAPI/Swagger. For complex queries, optimize with Apollo Client caching.
How do I handle authentication for third-party integrations (e.g., mobile apps)?
For third-party apps, generate a `STOREFRONT_KEY` via the Bagisto admin panel (under **Settings > API Keys**). This key authenticates requests to the shop API. For admin integrations, use token-based auth with RBAC. Both methods support rate limiting and can be extended via middleware (e.g., `STOREFRONT_RATE_LIMIT` in `.env`).
Are there performance concerns with GraphQL? How can I optimize nested queries?
GraphQL can be resource-intensive for deeply nested queries (e.g., orders with embedded addresses/payments). Mitigate this by using **data loaders** (API Platform’s `State` processors) or frontend optimizations like Apollo Client’s `@defer` or `@stream`. Benchmark with tools like [GraphQL Benchmark](https://github.com/automattic/graphql-benchmark).
How do I customize the API responses or add new endpoints?
Extend the API by creating custom **API resources** (e.g., `php artisan make:api-resource CustomProduct`). Override serialization with DTOs or use API Platform’s `State` processors. For new endpoints, define routes in `routes/api.php` and bind them to controllers. Documentation updates automatically via OpenAPI.
What database changes does this package require? Will it work with PostgreSQL?
The package adds minimal schema changes (e.g., audit logs, CSV export tables) but **requires Bagisto’s existing database**. It supports **MySQL 8.0+** and **PostgreSQL 14+**. No migrations are bundled—ensure your Bagisto installation is up to date before installing. Test with a staging clone to verify compatibility.
How do I deploy this to production? Are there caching or rate-limiting best practices?
Deploy with `STOREFRONT_CACHE_TTL` (e.g., 3600 for Redis) and adjust `STOREFRONT_RATE_LIMIT` based on traffic. Use **Redis/Memcached** for caching API responses. For admin APIs, enable IP whitelisting in `.env` (`ADMIN_API_ALLOWED_IPS`). Monitor with Laravel Horizon or Prometheus for rate-limit breaches.
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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky