{"id":23960567,"url":"https://github.com/tredmann/php-ollama","last_synced_at":"2026-02-11T14:31:37.180Z","repository":{"id":270862384,"uuid":"911678089","full_name":"tredmann/php-ollama","owner":"tredmann","description":"PHP client library to interact with the Ollama API","archived":false,"fork":false,"pushed_at":"2025-01-10T13:44:42.000Z","size":48,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-09T18:54:18.732Z","etag":null,"topics":["ollama","ollama-api","ollama-client","ollama-php","php","php8"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tredmann.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2025-01-03T15:31:14.000Z","updated_at":"2025-05-16T23:33:38.000Z","dependencies_parsed_at":"2025-02-24T12:19:49.628Z","dependency_job_id":"0f348934-7865-40d5-8a28-0d9fdad52064","html_url":"https://github.com/tredmann/php-ollama","commit_stats":null,"previous_names":["tobias-redmann/php-ollama","tredmann/php-ollama"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/tredmann/php-ollama","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tredmann%2Fphp-ollama","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tredmann%2Fphp-ollama/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tredmann%2Fphp-ollama/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tredmann%2Fphp-ollama/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tredmann","download_url":"https://codeload.github.com/tredmann/php-ollama/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tredmann%2Fphp-ollama/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29335176,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-11T14:07:45.431Z","status":"ssl_error","status_checked_at":"2026-02-11T14:07:45.080Z","response_time":97,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["ollama","ollama-api","ollama-client","ollama-php","php","php8"],"created_at":"2025-01-06T19:30:06.058Z","updated_at":"2026-02-11T14:31:37.165Z","avatar_url":"https://github.com/tredmann.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP Ollama\n\nPHP Client Library to interact with Ollama API.\n\nThe intention is to work with models on your Ollama setup and not the create a delete models. Therefore,\nthis library will not implement any APIs to create, move or delete models. Here is a list of the APIs\nwe intend to implement and the status of the implementation:\n\n* [x] Completion (without streaming support)\n* [x] Chat Completion (without streaming support)\n* [x] List local models\n* [x] Show Model Information\n* [x] List Running Models\n* [x] Version\n\nThe checkout the [Ollama API Docs](https://github.com/ollama/ollama/blob/main/docs/api.md) for more information and the APIs we might miss.\n\nThis package contains some low-level API libraries as well as a convenient API wrapper for all APIs. \n\n## Installation\n```shell\ncomposer install tredmann/php-ollama\n```\n\n\n## Convenience Wrapper\n\nThe easiest way to ask the LLM things is to use the convenience wrapper:\n\n```php\nuse Ollama\\Ollama;\n\n$ollama = new Ollama(model: 'gemma2:latest');\n\necho $ollama-\u003ecompletion(prompt: 'What is the capitol of Germany?');\n// The capital of Germany is **Berlin**.\n\n```\n\nIt does have a ton of limitations, but for quick results it is easy to use. I would highly encourage to look into\nthe low-level library.\n\n\n## General way of working with the low-level library\n\n### Creating the Client\n\n```php\nuse Ollama\\Client\\OllamaClient;\n\n$client = new OllamaClient(\n    baseUrl: 'http://localhost:11434' // default\n    );\n```\n\n### Inject the client into the respected API\n\n```php\nuse Ollama\\Api\\Completion;\n\n$completionApi = new Completion(client: $client);\n```\n\n### Use the API by creating an API request\n\n```php\nuse Ollama\\Requests\\CompletionRequest;\n\n$request = new CompletionRequest(\n    model: 'phi3.5:latest',\n    prompt: 'What is the capitol of Germany?' \n);\n```\n\n### Use a request to query the API\n\n```php\n$response = $completionApi-\u003egetCompletion(request: $request);\n```\n\n### Use the response\n\n```php\necho $response-\u003eresponse;\n// 'The capitol of Germany is Berlin.'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftredmann%2Fphp-ollama","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftredmann%2Fphp-ollama","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftredmann%2Fphp-ollama/lists"}