- What Laravel and PHP versions does baks-dev/wildberries-products support?
- The package requires **Laravel 10+** and **PHP 8.4+**. If your project uses an older Laravel version (e.g., 8 or 9), you’ll need to upgrade or create a custom bridge layer. Lumen or non-Laravel PHP stacks are not officially supported and would require significant adaptation.
- How do I install and set up the Wildberries module in Laravel?
- Run `composer require baks-dev/wildberries-products`, then execute `php bin/console baks:assets:install` to set up configuration and assets. Afterward, generate and apply migrations with `php bin/console doctrine:migrations:diff` and `php bin/console doctrine:migrations:migrate`. Ensure your `.env` includes Wildberries API credentials.
- Does this package support Wildberries product variants (e.g., sizes, colors) and custom attributes?
- Yes, the package handles product variants and custom attributes like `wildberries_seller_id` or `tax_class`. It maps Wildberries’ **article vs. offer** distinction to your schema, but you may need to extend the Eloquent model or migrations to align with your existing product structure. Check the migration files for attribute mappings.
- How does authentication work with the Wildberries API? Are OAuth2 or API keys supported?
- The package primarily supports **API keys** for authentication, stored securely in environment variables (e.g., `WILDBERRIES_API_KEY`). OAuth2 is not natively supported, but you can extend the service layer to integrate it. For token refresh logic, implement a custom observer or job to handle expired tokens dynamically.
- Can I sync Wildberries products in real-time, or is polling required?
- The package defaults to **polling-based syncs**, but you can layer real-time updates using Laravel’s **queues** or **webhooks**. For webhooks, extend the package to listen to Wildberries’ event notifications (e.g., inventory changes) and trigger jobs. Rate limits may still apply, so use exponential backoff for retries.
- What happens if a product sync fails (e.g., invalid SKU or API error)? How are errors logged?
- Failed syncs are logged via Laravel’s **monolog** system (check `storage/logs/laravel.log`). The package does not include a dead-letter queue by default, but you can implement one using Laravel Queues with retry logic. For idempotency, ensure your database constraints (e.g., `sku UNIQUE`) match Wildberries’ requirements.
- How do I extend the product model to add Wildberries-specific fields (e.g., category_id) without forking?
- Extend the base Eloquent model by publishing and modifying the package’s assets (`php bin/console vendor:publish --tag=wildberries-products`). Override the model in your app’s `app/Models/` directory and add traits or relationships. Use service container bindings if dependency injection is needed for custom logic.
- Are there performance considerations for syncing large catalogs (e.g., 10K+ products)?
- For large catalogs, use **batch processing** (e.g., sync 100 products per request) and **Redis caching** for API responses. The package doesn’t include built-in caching, but you can wrap the API client with a cache layer. Monitor Wildberries’ rate limits (typically 10–100 requests/minute) and implement queue-based throttling.
- Does this package handle GDPR or data residency for Russian customer data in Wildberries?
- The package itself does not enforce GDPR compliance, but it provides the infrastructure to log product changes via migrations and observers. For compliance, implement **audit trails** (e.g., track `created_at`, `updated_at` for Wildberries products) and ensure data storage aligns with your legal requirements. Use Laravel’s **policy system** to restrict access if needed.
- What alternatives exist if I need Wildberries integration but this package doesn’t fit my architecture?
- Alternatives include **custom API wrappers** (e.g., Guzzle + Laravel HTTP client) or third-party packages like `spatie/laravel-wildberries`. For headless systems, consider a **serverless approach** with AWS Lambda or a microservice using Laravel Sanctum for API access. If you need event-driven workflows, pair this package with Laravel’s **events** or a message broker like RabbitMQ.