- Is this package compatible with Laravel 8/9 and PHP 8.x?
- No, this package requires PHP 5.2+, which is outdated for modern Laravel (8.x+). For Laravel 8/9, use the official `automattic/woocommerce` SDK instead, which supports PHP 7.4+ and includes Laravel-specific features like service container integration.
- How do I integrate this with Laravel’s HTTP client (Guzzle) or service container?
- While not Laravel-native, you can wrap the client in Laravel’s HTTP facade or bind it to the service container. For example, use `Http::withOptions(['debug' => true])` or register it as a singleton in `AppServiceProvider` with your WooCommerce API keys and timeout settings.
- Does this package support WooCommerce REST API v3 or GraphQL?
- This library only supports WooCommerce REST API v2. For v3 or GraphQL, use the official `automattic/woocommerce` package, which is actively maintained and includes support for newer API versions and features like webhooks.
- How can I handle API rate limits (e.g., 60 requests/minute) in Laravel?
- Use Laravel’s `retry()` helper or implement exponential backoff in a custom service. For bulk operations, cache responses with `Cache::remember()` or offload tasks to queues (e.g., `SyncOrdersJob`) to avoid hitting rate limits.
- What’s the best way to store WooCommerce API credentials in Laravel?
- Store `consumer_key` and `consumer_secret` in Laravel’s `.env` file (e.g., `WOOCOMMERCE_KEY=your_key`). For production, use a secrets manager like AWS Secrets Manager or Laravel’s `config/services.php` with encrypted values.
- Can I use this package for real-time order updates or webhooks?
- This package doesn’t natively support webhooks, but you can poll the API periodically and trigger Laravel events (e.g., `order.created`) via a scheduled job or queue worker. For true webhook support, use `automattic/woocommerce`.
- How do I debug API errors or enable SSL verification in production?
- Enable debug mode with `$client->set_options(['debug' => true])` to log requests/responses. For production, enforce SSL verification by setting `'ssl_verify' => true` in the client options and configure Laravel’s `TrustProxies` middleware for proxy setups.
- What are the alternatives to this package for Laravel + WooCommerce?
- Consider the official `automattic/woocommerce` SDK (actively maintained, Laravel-compatible) or `wp-api-php/client` for a more modern approach. Both support newer PHP versions, webhooks, and GraphQL, while this package is abandoned and lacks Laravel-specific features.
- How can I cache API responses to improve performance?
- Wrap API calls in Laravel’s cache layer, e.g., `Cache::remember('woocommerce_orders', now()->addHours(1), fn() => $client->orders->get())`. For dynamic data, use Redis or database caching with TTLs to balance freshness and performance.
- Does this package support bulk operations like importing/exporting orders or products?
- No, this package lacks built-in bulk operations. For large datasets, use Laravel queues to process records in batches (e.g., `OrderImportJob`) or implement pagination in custom loops (e.g., `?per_page=100`). Consider `automattic/woocommerce` for better scalability.