Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
ed6cfa0
docs(client): add phpdoc for client resources
tharropoulos May 25, 2026
3bba03c
docs(debug): add phpdoc for debug class methods
tharropoulos May 25, 2026
4ac3b43
docs(metrics): add phpdoc for metrics class methods
tharropoulos May 25, 2026
d5cb20c
docs(health): add phpdoc for health class methods
tharropoulos May 25, 2026
c9bbc6b
docs(operations): add phpdoc for operations class methods
tharropoulos May 25, 2026
a7edf35
docs(multi-search): add phpdoc for multi-search class methods
tharropoulos May 25, 2026
85842d3
docs(analytics): add phpdoc for analytics class methods
tharropoulos May 25, 2026
5e69222
docs(analytics-rules): add phpdoc for analytics rules and events clas…
tharropoulos May 25, 2026
a8485d3
docs(analytics-v1): add phpdoc for legacy v1 analytics class methods
tharropoulos May 25, 2026
cafba03
docs(stemming): add phpdoc for stemming class methods
tharropoulos May 25, 2026
ac29b5c
docs(collections): add phpdoc for collection class methods
tharropoulos May 25, 2026
7a442ec
docs(documents): add phpdoc for document class methods
tharropoulos May 25, 2026
67b1127
docs(aliases): add phpdoc for alias class methods
tharropoulos May 25, 2026
02064d8
docs(keys): add phpdoc for api key class methods
tharropoulos May 25, 2026
bc1b2a9
docs(presets): add phpdoc for preset class methods
tharropoulos May 25, 2026
1ada252
docs(stopwords): add phpdoc for stopword class methods
tharropoulos May 25, 2026
c286c59
docs(conversations): add phpdoc for conversation class methods
tharropoulos May 25, 2026
3531dbe
docs(nl-search-models): add phpdoc for nl search model class methods
tharropoulos May 25, 2026
4a09319
docs(synonym-sets): add phpdoc for synonym set class methods
tharropoulos May 25, 2026
f6396ab
docs(curation-sets): add phpdoc for curation set class methods
tharropoulos May 25, 2026
46478cb
docs(overrides-synonyms): add phpdoc for legacy collection-scoped ove…
tharropoulos May 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/Alias.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ public function endPointPath(): string
}

/**
* Find out which collection an alias points to by fetching it.
*
* @example
* $client->aliases['my-alias']->retrieve()
*
* @see https://typesense.org/docs/latest/api/collection-alias.html#retrieve-an-alias
*
* @return array
* @throws TypesenseClientError|HttpClientException
*/
Expand All @@ -54,6 +61,13 @@ public function retrieve(): array
}

/**
* Delete an alias.
*
* @example
* $client->aliases['my-alias']->delete()
*
* @see https://typesense.org/docs/latest/api/collection-alias.html#delete-an-alias
*
* @return array
* @throws TypesenseClientError|HttpClientException
*/
Expand Down
14 changes: 14 additions & 0 deletions src/Aliases.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ public function endPointPath(string $aliasName): string
}

/**
* Create or update an alias mapping for a collection.
*
* @example
* $client->aliases->upsert('my-alias', ['collection_name' => 'products'])
*
* @see https://typesense.org/docs/latest/api/collection-alias.html#upsert-an-alias
*
* @param string $name
* @param array $mapping
*
Expand All @@ -59,6 +66,13 @@ public function upsert(string $name, array $mapping): array
}

/**
* List all aliases and the collections they map to.
*
* @example
* $client->aliases->retrieve()
*
* @see https://typesense.org/docs/latest/api/collection-alias.html#list-all-aliases
*
* @return array
* @throws TypesenseClientError|HttpClientException
*/
Expand Down
19 changes: 19 additions & 0 deletions src/Analytics.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ public function __construct(ApiCall $apiCall)
$this->apiCall = $apiCall;
}

/**
* Access the analytics rules resource. Use as a method-style endpoint to list or create rules,
* or chain `[$id]` on the returned object to access a single rule.
*
* @example
* $client->analytics->rules()->retrieve()
* @example
* $client->analytics->rules()['rule-1']->retrieve()
*
* @see https://typesense.org/docs/latest/api/analytics-query-suggestions.html
*/
public function rules()
{
if (!isset($this->rules)) {
Expand All @@ -25,6 +36,14 @@ public function rules()
return $this->rules;
}

/**
* Access the analytics events resource to send analytics events.
*
* @example
* $client->analytics->events()->create(['type' => 'click', 'name' => 'products_click', 'data' => []])
*
* @see https://typesense.org/docs/latest/api/analytics-query-suggestions.html
*/
public function events()
{
if (!isset($this->events)) {
Expand Down
18 changes: 14 additions & 4 deletions src/AnalyticsEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,13 @@ public function __construct(ApiCall $apiCall)
}

/**
* Create an analytics event
*
* Submit a single analytics event. The event must correspond to an existing analytics rule by name.
*
* @example
* $client->analytics->events()->create(['type' => 'click', 'name' => 'products_click', 'data' => []])
*
* @see https://typesense.org/docs/latest/api/analytics-query-suggestions.html
*
* @param array $params Event parameters including name, event_type, and data
* @return array Response from the API
* @throws TypesenseClientError|HttpClientException
Expand All @@ -41,8 +46,13 @@ public function create(array $params)
}

/**
* Retrieve analytics events
*
* Retrieve the most recent events for a user and rule.
*
* @example
* $client->analytics->events()->retrieve(['user_id' => 'u1', 'name' => 'products_click', 'n' => 10])
*
* @see https://typesense.org/docs/latest/api/analytics-query-suggestions.html
*
* @param array $params Query parameters
* @return array Response from the API
*/
Expand Down
7 changes: 7 additions & 0 deletions src/AnalyticsEventsV1.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ public function __construct(ApiCall $apiCall)
}

/**
* Submit a legacy v1 analytics event.
*
* @example
* $client->analyticsV1->events()->create(['type' => 'click', 'name' => 'products_click', 'data' => []])
*
* @see https://typesense.org/docs/29.0/api/analytics-query-suggestions.html
*
* @param array $params
*
* @return array
Expand Down
27 changes: 21 additions & 6 deletions src/AnalyticsRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@ public function __construct(string $ruleName, ApiCall $apiCall)
}

/**
* Retrieve a specific analytics rule
*
* Retrieve the details of an analytics rule, given its name.
*
* @example
* $client->analytics->rules()['rule-1']->retrieve()
*
* @see https://typesense.org/docs/latest/api/analytics-query-suggestions.html
*
* @return array Response from the API
*/
public function retrieve()
Expand All @@ -24,8 +29,13 @@ public function retrieve()
}

/**
* Delete a specific analytics rule
*
* Permanently deletes an analytics rule, given its name.
*
* @example
* $client->analytics->rules()['rule-1']->delete()
*
* @see https://typesense.org/docs/latest/api/analytics-query-suggestions.html
*
* @return array Response from the API
*/
public function delete()
Expand All @@ -34,8 +44,13 @@ public function delete()
}

/**
* Update a specific analytics rule
*
* Upserts an analytics rule with the given name.
*
* @example
* $client->analytics->rules()['rule-1']->update(['type' => 'popular_queries', 'params' => []])
*
* @see https://typesense.org/docs/latest/api/analytics-query-suggestions.html
*
* @param array $params Rule parameters
* @return array Response from the API
*/
Expand Down
16 changes: 16 additions & 0 deletions src/AnalyticsRuleV1.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,27 @@ public function __construct(string $ruleName, ApiCall $apiCall)
$this->apiCall = $apiCall;
}

/**
* Retrieve a legacy v1 analytics rule by name.
*
* @example
* $client->analyticsV1->rules()['rule-1']->retrieve()
*
* @see https://typesense.org/docs/29.0/api/analytics-query-suggestions.html
*/
public function retrieve()
{
return $this->apiCall->get($this->endpointPath(), []);
}

/**
* Delete a legacy v1 analytics rule by name.
*
* @example
* $client->analyticsV1->rules()['rule-1']->delete()
*
* @see https://typesense.org/docs/29.0/api/analytics-query-suggestions.html
*/
public function delete()
{
return $this->apiCall->delete($this->endpointPath());
Expand Down
18 changes: 14 additions & 4 deletions src/AnalyticsRules.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@ public function __construct(ApiCall $apiCall)
}

/**
* Create multiple analytics rules
*
* Create one or more analytics rules. You can send a single rule object or an array of rule objects.
*
* @example
* $client->analytics->rules()->create(['name' => 'products_query_hits', 'type' => 'popular_queries', 'params' => []])
*
* @see https://typesense.org/docs/latest/api/analytics-query-suggestions.html
*
* @param array $rules Array of rule objects
* @return array Response from the API
*/
Expand All @@ -30,8 +35,13 @@ public function create(array $rules)
}

/**
* Retrieve all analytics rules
*
* Retrieve all analytics rules.
*
* @example
* $client->analytics->rules()->retrieve()
*
* @see https://typesense.org/docs/latest/api/analytics-query-suggestions.html
*
* @return array Response from the API
*/
public function retrieve()
Expand Down
16 changes: 16 additions & 0 deletions src/AnalyticsRulesV1.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,27 @@ public function __get($ruleName)
return $this->analyticsRules[$ruleName];
}

/**
* Upsert a legacy v1 analytics rule by name.
*
* @example
* $client->analyticsV1->rules()->upsert('products_query_hits', ['type' => 'popular_queries', 'params' => []])
*
* @see https://typesense.org/docs/29.0/api/analytics-query-suggestions.html
*/
public function upsert($ruleName, $params)
{
return $this->apiCall->put($this->endpoint_path($ruleName), $params);
}

/**
* Retrieve all legacy v1 analytics rules.
*
* @example
* $client->analyticsV1->rules()->retrieve()
*
* @see https://typesense.org/docs/29.0/api/analytics-query-suggestions.html
*/
public function retrieve()
{
return $this->apiCall->get($this->endpoint_path(), []);
Expand Down
26 changes: 26 additions & 0 deletions src/AnalyticsV1.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace Typesense;

/**
* @deprecated Deprecated starting with Typesense Server v30. Please migrate to `$client->analytics` (new Analytics APIs).
*/
class AnalyticsV1
{
const RESOURCE_PATH = '/analytics';
Expand All @@ -17,6 +20,19 @@ public function __construct(ApiCall $apiCall)
$this->apiCall = $apiCall;
}

/**
* Access the legacy v1 analytics rules resource. Use as a method-style endpoint to list or upsert rules,
* or chain `[$id]` on the returned object to access a single rule.
*
* @example
* $client->analyticsV1->rules()->retrieve()
* @example
* $client->analyticsV1->rules()['rule-1']->retrieve()
*
* @see https://typesense.org/docs/29.0/api/analytics-query-suggestions.html
*
* @deprecated Deprecated starting with Typesense Server v30. Please migrate to `$client->analytics` (new Analytics APIs).
*/
public function rules()
{
if (!isset($this->rules)) {
Expand All @@ -25,6 +41,16 @@ public function rules()
return $this->rules;
}

/**
* Access the legacy v1 analytics events resource to send analytics events.
*
* @example
* $client->analyticsV1->events()->create(['type' => 'click', 'name' => 'products_click', 'data' => []])
*
* @see https://typesense.org/docs/29.0/api/analytics-query-suggestions.html
*
* @deprecated Deprecated starting with Typesense Server v30. Please migrate to `$client->analytics` (new Analytics APIs).
*/
public function events()
{
if (!isset($this->events)) {
Expand Down
Loading
Loading