{"id":14964973,"url":"https://github.com/evowareio/ollama-php","last_synced_at":"2025-10-06T08:32:27.105Z","repository":{"id":230936074,"uuid":"778570248","full_name":"evowareio/ollama-php","owner":"evowareio","description":"A wrapper library for interacting with Ollama API in a simplified, object driven manner.","archived":false,"fork":false,"pushed_at":"2024-06-27T17:10:53.000Z","size":137,"stargazers_count":23,"open_issues_count":4,"forks_count":5,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-09-21T10:32:22.093Z","etag":null,"topics":["gpt","library","llm","ollama","ollama-api","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/evowareio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-28T00:59:58.000Z","updated_at":"2025-05-05T05:23:49.000Z","dependencies_parsed_at":"2024-04-11T03:30:10.004Z","dependency_job_id":"d51e92d0-1866-4bcc-b961-b16f8bbd35d9","html_url":"https://github.com/evowareio/ollama-php","commit_stats":{"total_commits":21,"total_committers":2,"mean_commits":10.5,"dds":0.09523809523809523,"last_synced_commit":"aa6ddacad495396b6d81e7b7e1a59948e39ece55"},"previous_names":["evowareio/ollama-php"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/evowareio/ollama-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evowareio%2Follama-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evowareio%2Follama-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evowareio%2Follama-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evowareio%2Follama-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/evowareio","download_url":"https://codeload.github.com/evowareio/ollama-php/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evowareio%2Follama-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278579213,"owners_count":26009967,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gpt","library","llm","ollama","ollama-api","php"],"created_at":"2024-09-24T13:34:03.055Z","updated_at":"2025-10-06T08:32:26.832Z","avatar_url":"https://github.com/evowareio.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ollama PHP\n\nA comprehensive PHP library designed for seamless interaction with the Ollama server, facilitating a range of operations from generating text completions to managing models and producing embeddings.\n\n**But what's Ollama?**\nOllama is a tool for running open-source Large Language Models locally. You can find more information about Ollama directly at the project [repository](https://github.com/ollama/ollama) or [documentation page](https://github.com/ollama/ollama/blob/main/docs/README.md).\n\n## Installation\n\nTo integrate the Ollama PHP Adapter into your project, use Composer for a smooth installation process:\n\n```bash\ncomposer require evoware/ollama-php\n```\n\n## Usage:\n\nThe Ollama PHP Adapter simplifies the complexity of interacting with the Ollama server, providing intuitive methods for various functionalities.\n\n### Generating Text Completions\nGenerate text completions by providing a prompt to the model. Access the completion text using the getResponse() method:\n```php\nuse GuzzleHttp\\Client as HttpClient;\nuse Evoware\\OllamaPHP\\OllamaClient;\n\n$ollamaClient = new OllamaClient(new HttpClient());\n\n$response = $ollamaClient-\u003egenerateCompletion('The capital of France is ', ['model' =\u003e 'mistral:7b']);\n$completionText = $response-\u003egetResponse(); // Returns the generated completion text.\n\n```\n\n#### Interacting with models:\nManage your local models by listing, pulling, and interacting through the provided methods:\n```php\n// List all local models\n$models = $ollamaClient-\u003emodel()-\u003elist();\n\n// Pull a local model\n$result = $ollamaClient-\u003emodel()-\u003epull('mistral:7b');\n\n// Alternatively, access via the getModelRepository method\n$result = $ollamaClient-\u003egetModelRepository()-\u003epull('mistral:7b');\n\n// Load a Modelfile\n$ollamaClient-\u003efromModelFile('/path/to/modelfile');\n```\n\nTo learn more about model file format, please visit Ollama Model File documentation [here](https://github.com/ollama/ollama/blob/main/docs/modelfile.md).\n\n#### Generating embeddings:\nProduce embeddings for a given text, returning an array of embedding data through the `EmbeddingsResponse` object:\n```php\n$embeddings = $ollamaClient-\u003egenerateEmbeddings('This is my text to be embedded.', 'nomic-embed-text');\n```\n\n### Response Types\nThe adapter delineates responses into specific object types for clarity and ease of use:\n\n* **CompletionResponse**: Handles the data from text completion requests.\n* **ChatCompletionResponse**: Manages chat completion data.\n* **EmbeddingsResponse**: Encapsulates embedding data.\n* **ModelOperationResponse**: Represents the outcome of model operations (create, delete, pull, etc.).\n\nResponses provide access to the underlying Guzzle Response via the `getHttpResponse()` method for further customization and handling.\n\n## Roadmap\n\n* Handling streaming responses.\n* Introduction of ChatSession class for storing chat context in a styructured manner.\n* Laravel facade support\n\n## Caution\n⚠️ Development Stage: This project is in its early development stages and is not recommended for production environments. It is provided as-is, without any guarantees. Proceed with caution and use at your own risk. ⚠️\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevowareio%2Follama-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevowareio%2Follama-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevowareio%2Follama-php/lists"}