Download the PHP package qryma-ai/qryma-php without Composer
On this page you can find all versions of the php package qryma-ai/qryma-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package qryma-php
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
- Installation
- Quick Start
- Usage Examples
- API Reference
- Configuration
- Error Handling
- Testing
- Contributing
- License
Installation
You can install the Qryma PHP SDK using Composer:
Quick Start
Usage Examples
Basic Search
Search with All Parameters
Using SearchOptions Object
For more control, you can use the SearchOptions class directly:
Custom Configuration
You can specify additional configuration options:
API Response Format
The search() method returns the raw API response in the following format:
Field descriptions:
title: Search result titledate: Publication date (if available)link: URL of the search resultposition: Position in the results listsite_name: Name of the websitesnippet: Brief description or excerpt from the pagetext: Full text of the page
API Reference
qryma($config)
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:
QrymaClientinstance
QrymaClient::search($query, $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)maxResults: Maximum number of results to return (default: 5, range: 1-10)safe: Safe search mode: true or false (default: false)mode: Result detail mode: 'snippet' for brief descriptions or 'fulltext' for detailed content (default: 'snippet')
Returns:
- Raw API response array containing the search results
Alternative: Using QrymaClient class directly
If you prefer, you can still use the class directly:
Configuration
Environment Variables
You can configure the API key using environment variables:
Then in your code:
Error Handling
The SDK raises exceptions for API errors:
Common error conditions:
- Invalid API key
- Rate limiting
- Network timeouts
- Invalid parameters
Testing
The SDK includes a simple test file. To run the test:
- First, replace the placeholder API key in
tests/TestSearch.phpwith your actual API key - Then run the test:
Contributing
Contributions are welcome! Please see our contributing guide for more information.
License
MIT License - see the LICENSE file for details.
Support
If you encounter any issues or have questions, please:
- Check the documentation
- Open an issue on GitHub
- Contact support at [email protected]
Changelog
1.0.0
- 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