Download the PHP package searchcraft/searchcraft-php without Composer

On this page you can find all versions of the php package searchcraft/searchcraft-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package searchcraft-php

Searchcraft API PHP Client

A PSR-compatible PHP client for the Searchcraft API.

Test Status

Documentation | Discord | FAQ | Issues / Requests | Searchcraft Cloud | Searchcraft Website

Installation

You will also need to install a PSR-18 compatible HTTP client, such as Guzzle.

Basic Usage

Initialize the client

The client can be initialized with different types of API keys, depending on your access requirements:

By default, the client connects to http://localhost:8000. To use a different endpoint such as a Searchcraft Cloud cluster:

Using PSR-18 HTTP Client

The client uses PSR-18 HTTP Client discovery to find an available HTTP client. You can also provide your own:

Searchcraft PHP Client does not include a specific HTTP client in its require dependencies but Guzzle is recommended. You will need to install one in order to use the Searchcraft client.

Search Operations

Search operations require an admin key or read key.

Basic Search

time_taken on the response is reported in seconds. limit defaults to 20 and is rejected client-side above 200.

Scoping a Search to Specific Fields

fields restricts a query to particular fields instead of the index's configured search_fields. Pass a field name, a list of names, or a map of name to boost. The engine honors it for fuzzy and term clauses.

Boolean Occurrence

occur sets how the clause participates in matching. It is placed beside the mode key inside the query object for you.

occur and fields both describe a single clause, so they apply to string queries only. Passing either alongside an array query throws a SearchcraftException — set them inside the clause itself in that case.

Additional Search Options

Complex Queries

Pass an array instead of a string to build a multi-clause query. It is forwarded to the engine verbatim, which is how you reach the query kinds that have no string shorthand. Each clause takes an occur of should, must, or mustnot, and a fields selector belongs inside the clause rather than in the options array.

Federation Search

Index Operations

Index administration operations require an admin key.

List Indexes

Get Index Details

Create Index

Update Index

Note if you are not adding, removing or changing properties of schema fields will likely want to use the PATCH operation instead. An update request will remove existing documents but for patchable updates your index is not emptied. See the docs for details on which properties are patchable.

updateIndex is a whole-schema replacement, so anything you leave out reverts to its default. It is also the only way to change fields or to clear search_fields, weight_multipliers or language — patchIndex cannot do either.

Patch Index

fields is not patchable — the engine carries the existing schema over verbatim and silently ignores a fields key here. search_fields, weight_multipliers and language cannot be cleared either, since the engine reads an empty value as "leave unchanged". Use updateIndex for both. time_decay_field can be cleared by passing an empty string.

Index Statistics

Delete Index

Document Operations

Document operations require an admin key or ingest key.

Add Documents

Update Documents

Get Document

Delete Documents

Stopword Operations

Stopwords are excluded from indexing and from queries when the index has exclude_stop_words enabled.

Federation Operations

Federation operations allow you to manage federations that combine multiple indexes for cross-index search. Federation administration operations require an admin key, while federation search requires a read key.

List Federations

Get Federation Details

Get Federations by Organization

List a Federation's Indexes

Federation Statistics

Create Federation

Update Federation

Delete Federation

AI Capabilities

Requires Searchcraft Engine 0.10.0 or later.

Check AI Capabilities for an Index

Streaming AI Search Summaries

The index must have ai_enabled: true and a valid ai.search_summary configuration. The engine streams Server-Sent Events: one metadata event, any number of delta events with content chunks, and a final done event. searchSummary() returns every parsed event, and you may optionally pass a callback to react to events as they arrive.

Authentication Operations

Get Keys for an Index

Check a Key's Permissions

The engine stores key permissions as a bitmask rather than a fixed set of levels. Combine the Searchcraft\Permissions constants with the bitwise OR operator. A key that simply lacks the permission is answered with a 403, which is reported as false rather than raised as an exception.

Individual bits: SEARCH, MODIFY_SYNONYMS, MODIFY_STOP_WORDS, MODIFY_DOCUMENTS, MODIFY_INDEX, MODIFY_AUTH, LLM_RAG_SUMMARIES, LLM_EXPANDED_KEYWORD_SEARCH, READ_ANALYTICS.

Presets come in two kinds. Levels say what a key can change: PRESET_READ (1), PRESET_INGEST (15), PRESET_ADMIN (63), PRESET_SUPER_USER (511). Add-ons are features a key can use on top of its level: PRESET_AI (64) and PRESET_ANALYTICS (256). Combine them with |.

Measure Operations

The Measure API is primarily used by SDKs and CMS integrations to capture search usage metrics and retrieve dashboard aggregates.

Check Whether Analytics Are Enabled

Track a Single Event

Track a Batch of Events

Dashboard Metrics

date_start and date_end are Unix timestamps in seconds. granularity is one of minutes, hours, days, weeks, months, or years.

Compatibility

Client version Searchcraft Engine
0.8.2 0.11.x
0.8.0 - 0.8.1 0.10.x
0.7.x 0.7.9 - 0.9.x

Error Handling

All operations should be wrapped in a try/catch block to handle errors:

Documentation

For view the rest of the endpoints and operations, please refer to the full Searchcraft API documentation.

To run unit tests

./vendor/bin/pest

License

Apache 2.0 License


All versions of searchcraft-php with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0
ext-json Version *
php-http/discovery Version ^1.7
psr/http-client Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package searchcraft/searchcraft-php contains the following files

Loading the files please wait ...