PHPackages                             islambaraka90/pinecone-php-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. islambaraka90/pinecone-php-client

ActiveLibrary[Database &amp; ORM](/categories/database)

islambaraka90/pinecone-php-client
=================================

A PHP client for connecting to Pinecone DB

0.1.1(3y ago)7973[1 issues](https://github.com/IslamBaraka90/pinecone-php-client/issues)MITPHPPHP 7.3||^8.0

Since Apr 8Pushed 3y ago1 watchersCompare

[ Source](https://github.com/IslamBaraka90/pinecone-php-client)[ Packagist](https://packagist.org/packages/islambaraka90/pinecone-php-client)[ RSS](/packages/islambaraka90-pinecone-php-client/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (3)Used By (0)

Pinecone PHP Client
===================

[](#pinecone-php-client)

This is a PHP client implementation for handling all of the Pinecone endpoints. This library was created because there was no existing PHP client for Pinecone vector database.

Pinecone Vector Database
========================

[](#pinecone-vector-database)

Pinecone is a vector database designed for high-performance similarity search and other similarity-related tasks. It provides a simple API for inserting and querying high-dimensional vectors, making it easy to build intelligent search applications that can handle large amounts of data.

Pinecone is used by OpenAI applications as part of its long-term memory architecture. By storing high-dimensional vectors in Pinecone, OpenAI applications can retrieve them quickly and efficiently when needed, allowing it to build complex models that can learn from large amounts of data and make more accurate predictions.

Pinecone's vector database is highly scalable and can handle millions or even billions of vectors with ease. It's designed to work with a variety of machine learning frameworks and libraries, making it easy to integrate into your existing workflow.

One of the key benefits of using Pinecone is its ability to perform fast, accurate similarity searches. This makes it ideal for applications such as image search, product recommendations, and personalized content delivery. By using Pinecone, you can build intelligent search applications that can handle large amounts of data and provide accurate results in real-time.

Overall, Pinecone is a powerful tool for anyone who needs to work with high-dimensional vectors and wants to build intelligent search applications that can handle large amounts of data. Whether you're building a recommendation engine, an image search application, or a personalized content delivery system, Pinecone can help you achieve your goals quickly and easily.

**Important Note:**

This library isn't restricted to only OpenAI embedding and can be used with any other embedding.

Make sure to check the dimensions of your embedding before using it with this library.

Installation
------------

[](#installation)

To install the Pinecone PHP Client, you can use Composer. Run the following command:

```
composer require islambaraka90/pinecone-php-client

```

Usage
-----

[](#usage)

### Initialization

[](#initialization)

To use the Pinecone PHP Client, you need to first initialize it with your API key and Pinecone endpoint. You can do this by creating a new instance of the Pinecone client:

```
use IslamBaraka90\PineconeClient;

$this->api_key =  $_ENV['PINCONE_KEY'] ?: '';
$this->environment = $_ENV['PINCONE_ENV'] ?: 'us-east1-gcp';
$this->client = new PineconePhpClient( $this->api_key ,  $this->environment );
```

### Listing Indexes

[](#listing-indexes)

To list all indexes available in your Pinecone instance, you can use the `listIndexes` method:

```
$response = $this->client->listIndexes();
```

### Creating an Index

[](#creating-an-index)

To create a new index, you can use the `createIndex` method:

```
$name = 'my-index';
$dimension = 1536;
$result = $this->client->createIndex($name, $dimension);
```

### Deleting an Index

[](#deleting-an-index)

To delete an index, you can use the `deleteIndex` method:

```
$response = $this->client->deleteIndex('my-index');
```

### Describing an Index

[](#describing-an-index)

To get information about an index, you can use the `describeIndex` method:

```
$this->client->describeIndex('my-index');
```

### Working with an Index

[](#working-with-an-index)

To work with a specific index, you can use the `Index` method to get an instance of the `Index` interface. Here are some examples of methods available on the `Index` interface:

#### Describe Index Stats

[](#describe-index-stats)

To get statistics about an index, you can use the `describeIndexStats` method:

```
$index = $this->client->Index('my-index');
$state = $index->describeIndexStats();
```

#### Upsert Vectors

[](#upsert-vectors)

To insert or update vectors in an index, you can use the `upsert` method:

```
$index = $this->client->Index('my-index');
$state = $index->describeIndexStats();

// Upsert 20 vectors
$vectorsFile = __DIR__ . '/vectors_objects.json';
$vectors = json_decode(file_get_contents($vectorsFile), true);
$project_id = 'project-0000'.rand(1,99);
$response = $index->upsert($project_id,$vectors['vectors']);
```

#### Query Vectors

[](#query-vectors)

To query vectors from an index, you can use the `query` method:

```
$index = $this->client->Index('my-index');
$state = $index->describeIndexStats();

// Query vectors
$vectorsFile = __DIR__ . '/query.json';
$vectors = json_decode(file_get_contents($vectorsFile), true);
$response = $index->query('project-000001',$vectors, [],3);
$response = json_decode($response, true);
```

#### Fetch Vectors

[](#fetch-vectors)

To fetch vectors from an index, you can use the `fetch` method:

```
$index = $this->client->Index('my-index');
$state = $index->describeIndexStats();

// Fetch vectors
$id = "DEeSvRP8XKZwzpWD";
$response = $index->fetch([$id], 'project-000001');
$response = json_decode($response, true);
```

#### Update Vectors

[](#update-vectors)

To update vectors in an index, you can use the `update` method:

```
$index = $this->client->Index('my-index');
$state = $index->describeIndexStats();

// Update vectors
$id = "DEeSvRP8XKZwzpWD";
$response = $index->update($id, 'project-000001',null,null,['testing' => 'testing5']);
$response = json_decode($response, true);
```

#### Delete Vectors

[](#delete-vectors)

To delete vectors from an index, you can use the `delete` method:

```
$index = $this->client->Index('my-index');
$state = $index->describeIndexStats();

// Delete vectors
$id = "DEeSvRP8XKZwzpWD";
$response = $index->delete($id, 'project-000001');
```

Contributing
------------

[](#contributing)

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License
-------

[](#license)

[MIT](https://choosealicense.com/licenses/mit/)

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

2

Last Release

1181d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/72acdb55d37d69bfd4703ae2126dd30170b1bf989e2cc4075116513b53898627?d=identicon)[IslamBaraka90](/maintainers/IslamBaraka90)

---

Top Contributors

[![IslamBaraka90](https://avatars.githubusercontent.com/u/111580279?v=4)](https://github.com/IslamBaraka90 "IslamBaraka90 (11 commits)")[![Islam-Baraka](https://avatars.githubusercontent.com/u/35257732?v=4)](https://github.com/Islam-Baraka "Islam-Baraka (1 commits)")

---

Tags

clientdatabasepinecone

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/islambaraka90-pinecone-php-client/health.svg)

```
[![Health](https://phpackages.com/badges/islambaraka90-pinecone-php-client/health.svg)](https://phpackages.com/packages/islambaraka90-pinecone-php-client)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k543.8M20.1k](/packages/laravel-framework)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[probots-io/pinecone-php

Unofficial PHP Client for Pinecone Vector Database (pinecone.io)

75459.8k8](/packages/probots-io-pinecone-php)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)[lion/bundle

Lion-framework configuration and initialization package

122.3k4](/packages/lion-bundle)[hardcastle/xrpl_php

PHP SDK / Client for the XRP Ledger

1110.7k7](/packages/hardcastle-xrpl-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
