PHPackages                             qryma-ai/qryma-php - 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. qryma-ai/qryma-php

ActiveLibrary

qryma-ai/qryma-php
==================

Qryma Search API PHP SDK

v1.0.1(3d ago)04↓100%MITPHPPHP &gt;=7.4

Since Mar 19Pushed 3d agoCompare

[ Source](https://github.com/qryma-ai/qryma-php)[ Packagist](https://packagist.org/packages/qryma-ai/qryma-php)[ RSS](/packages/qryma-ai-qryma-php/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (2)Versions (1)Used By (0)

Qryma PHP SDK
=============

[](#qryma-php-sdk)

A PHP SDK for the Qryma Search API, providing a simple and intuitive interface for accessing Qryma's powerful search capabilities.

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Quick Start](#quick-start)
- [Usage Examples](#usage-examples)
- [API Reference](#api-reference)
- [Configuration](#configuration)
- [Error Handling](#error-handling)
- [Testing](#testing)
- [Contributing](#contributing)
- [License](#license)

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

[](#installation)

You can install the Qryma PHP SDK using Composer:

```
composer require qryma-ai/qryma-php
```

Quick Start
-----------

[](#quick-start)

```
// To install: composer require qryma-ai/qryma-php
require __DIR__ . '/vendor/autoload.php';

use function Qryma\qryma;

$client = qryma(['apiKey' => 'ak-********************']);

$response = $client->search('artificial intelligence', ['lang' => 'en']);

print_r($response);
```

Usage Examples
--------------

[](#usage-examples)

### Basic Search

[](#basic-search)

```
require __DIR__ . '/vendor/autoload.php';

use function Qryma\qryma;

$client = qryma(['apiKey' => 'ak-********************']);

$response = $client->search('python programming');

// Access the organic results
$results = $response['organic'] ?? [];
foreach ($results as $result) {
    echo $result['title'] . "\n";
    echo $result['link'] . "\n";
    echo $result['snippet'] . "\n";
    echo "\n";
}
```

### Search with All Parameters

[](#search-with-all-parameters)

```
require __DIR__ . '/vendor/autoload.php';

use function Qryma\qryma;

$client = qryma(['apiKey' => 'ak-********************']);

$response = $client->search('machine learning tutorials', [
    'lang' => 'en',
    'start' => 0,
    'safe' => false,
    'detail' => false
]);

$results = $response['organic'] ?? [];
echo 'Found ' . count($results) . ' results' . "\n";
```

### Using SearchOptions Object

[](#using-searchoptions-object)

For more control, you can use the `SearchOptions` class directly:

```
require __DIR__ . '/vendor/autoload.php';

use Qryma\SearchOptions;

$client = qryma(['apiKey' => 'ak-********************']);

$options = new SearchOptions([
    'lang' => 'en',
    'safe' => true
]);

$response = $client->search('python programming', $options);

print_r($response);
```

### Custom Configuration

[](#custom-configuration)

You can specify additional configuration options:

```
require __DIR__ . '/vendor/autoload.php';

use function Qryma\qryma;

$client = qryma([
    'apiKey' => 'ak-********************',
    'baseUrl' => 'https://custom.qryma.com',
    'timeout' => 60
]);
$response = $client->search('test query');
print_r($response);
```

### API Response Format

[](#api-response-format)

The `search()` method returns the raw API response in the following format:

```
[
  "organic" => [
    [
      "title" => "Result Title",
      "date" => "",
      "link" => "https://example.com",
      "position" => 1,
      "site_name" => "Example.com",
      "snippet" => "Description text..."
    ]
  ]
]
```

**Field descriptions:**

- `title`: Search result title
- `date`: Publication date (if available)
- `link`: URL of the search result
- `position`: Position in the results list
- `site_name`: Name of the website
- `snippet`: Brief description or excerpt from the page

API Reference
-------------

[](#api-reference)

### qryma($config)

[](#qrymaconfig)

Factory function to create a Qryma client instance.

**Parameters:**

- `$config['apiKey']`: Your Qryma API key (required)
- `$config['baseUrl']`: Base URL for the API (optional, default: `https://search.qryma.com`)
- `$config['timeout']`: Request timeout in seconds (optional, default: 30)

**Returns:**

- `QrymaClient` instance

### QrymaClient::search($query, $options = \[\])

[](#qrymaclientsearchquery-options--)

Perform a search with the given query and return the raw API response.

**Parameters:**

- `$query`: Search query string (required)
- `$options`: Search options (optional)
    - `lang`: Language code for search results (e.g., 'am' for Amharic, 'en' for English)
    - `start`: Starting position of results (default: 0)
    - `safe`: Safe search mode: true or false (default: false)
    - `detail`: Include detailed results (default: false)

**Returns:**

- Raw API response array containing the search results

### Alternative: Using QrymaClient class directly

[](#alternative-using-qrymaclient-class-directly)

If you prefer, you can still use the class directly:

```
require __DIR__ . '/vendor/autoload.php';

use Qryma\QrymaClient;

$client = new QrymaClient('ak-********************');
$response = $client->search('artificial intelligence');
print_r($response);
```

Configuration
-------------

[](#configuration)

### Environment Variables

[](#environment-variables)

You can configure the API key using environment variables:

```
export QRYMA_API_KEY="your-api-key"
```

Then in your code:

```
require __DIR__ . '/vendor/autoload.php';

use function Qryma\qryma;

$client = qryma(['apiKey' => getenv('QRYMA_API_KEY')]);
```

Error Handling
--------------

[](#error-handling)

The SDK raises exceptions for API errors:

```
require __DIR__ . '/vendor/autoload.php';

use function Qryma\qryma;

try {
    $client = qryma(['apiKey' => 'ak-********************']);
    $response = $client->search('test query');
    $results = $response['organic'] ?? [];
    // Process results...

} catch (RuntimeException $e) {
    if (strpos($e->getMessage(), 'timed out') !== false) {
        echo 'Network timeout error';
    } elseif (strpos($e->getMessage(), 'API request failed') !== false) {
        echo 'API error';
    } else {
        echo 'Error: ' . $e->getMessage();
    }
}
```

Common error conditions:

- Invalid API key
- Rate limiting
- Network timeouts
- Invalid parameters

Testing
-------

[](#testing)

The SDK includes a simple test file. To run the test:

1. First, replace the placeholder API key in `tests/TestSearch.php` with your actual API key
2. Then run the test:

```
./vendor/bin/phpunit tests/TestSearch.php
```

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

[](#contributing)

Contributions are welcome! Please see our contributing guide for more information.

License
-------

[](#license)

MIT License - see the [LICENSE](LICENSE) file for details.

Support
-------

[](#support)

If you encounter any issues or have questions, please:

1. Check the [documentation](https://qryma.com/documentation.html)
2. Open an issue on GitHub
3. Contact support at

Changelog
---------

[](#changelog)

### 1.0.0

[](#100)

- Basic search functionality
- Simple `qryma()` factory function for easy initialization
- Advanced search with SearchOptions
- Result extraction methods
- API status check
- Error handling
- Comprehensive data models

###  Health Score

36

—

LowBetter than 83% of packages

Maintenance99

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity31

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

3d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2adb8595a56f484256f4f832aede00e709f0b59c352dd1e8bfd7600de47b6f09?d=identicon)[qryma-ai](/maintainers/qryma-ai)

---

Top Contributors

[![mychenkang](https://avatars.githubusercontent.com/u/52104298?v=4)](https://github.com/mychenkang "mychenkang (9 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/qryma-ai-qryma-php/health.svg)

```
[![Health](https://phpackages.com/badges/qryma-ai-qryma-php/health.svg)](https://phpackages.com/packages/qryma-ai-qryma-php)
```

PHPackages © 2026

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