- How do I install and initialize Pinecone PHP in a Laravel project?
- Run `composer require probots-io/pinecone-php` to install. Initialize with just an API key (`new Pinecone($apiKey)`) or include an index host upfront (`new Pinecone($apiKey, $indexHost)`). All requests auto-authenticate, and you can set the host later via `$pinecone->setIndexHost()`.
- Does this package support Pinecone’s serverless API (v1+)?
- Yes, Pinecone PHP is built for Pinecone’s latest serverless API (v1+). Versions before 1.0.0 support the legacy API. Check the [README](https://github.com/probots-io/pinecone-php) for version-specific details.
- Can I use this package with Laravel 10.x or 11.x?
- Yes, the package supports PHP 8.1+ and has been updated for compatibility with Laravel’s LTS versions (10.x, 11.x). Bind the client as a singleton in your service container for seamless integration.
- How do I handle API key security in production?
- Store your Pinecone API key in Laravel’s `.env` file (e.g., `PINECONE_API_KEY`). For enhanced security, use Hashicorp Vault or Laravel’s encryption for sensitive configurations. Rotate keys manually or via automated scripts.
- What endpoints does Pinecone PHP support?
- The package covers all Pinecone API endpoints (control and data) as per the [official docs](https://docs.pinecone.io/reference). Use `$pinecone->control()` for index/collection management and `$pinecone->data()` for vector operations like upserts or queries.
- How do I manage multi-region Pinecone deployments?
- Set the `indexHost` during initialization (e.g., `https://your-region-1.pinecone.io`) or dynamically with `$pinecone->setIndexHost()`. The package supports multi-region setups, but validate latency for your use case using Laravel’s `benchmark()` helper.
- Can I extend Pinecone PHP for custom functionality?
- Yes, the package is built on Saloon, which provides a fluent, extendable architecture. Override methods or create custom connectors for batch operations, custom metrics, or hybrid search logic without breaking core functionality.
- How should I test Pinecone PHP in Laravel?
- Mock Pinecone responses using Laravel’s `Http` facade. Test the updated `indexHost` format by simulating multi-region queries. For integration tests, use Laravel’s `DatabaseTransactions` or `Migrations` to reset Pinecone indices between runs.
- What’s the best way to handle async operations with Pinecone?
- Offload batch operations (e.g., upserts) to Laravel’s queue system. Use `dispatch()` with `ShouldQueue` jobs. For async queries, consider caching responses or using Laravel’s `cache()` helper to reduce Pinecone API calls.
- Are there alternatives to Pinecone PHP for Laravel?
- For Pinecone, this is the most Laravel-native option. Alternatives include raw Guzzle HTTP clients or other vector DB SDKs like Weaviate’s PHP client. However, Pinecone PHP offers Saloon’s elegance and Laravel’s service container integration out of the box.