{"id":22181008,"url":"https://github.com/easygithdev/phpopenai-examples","last_synced_at":"2026-01-05T17:05:21.176Z","repository":{"id":148262327,"uuid":"618377342","full_name":"EasyGithDev/PHPOpenAI-Examples","owner":"EasyGithDev","description":"Examples for the project PHPOpenAI","archived":false,"fork":false,"pushed_at":"2024-02-25T13:05:47.000Z","size":3359,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-29T23:30:16.963Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"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/EasyGithDev.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}},"created_at":"2023-03-24T10:39:04.000Z","updated_at":"2023-03-24T10:39:04.000Z","dependencies_parsed_at":"2024-02-25T14:35:45.817Z","dependency_job_id":null,"html_url":"https://github.com/EasyGithDev/PHPOpenAI-Examples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EasyGithDev%2FPHPOpenAI-Examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EasyGithDev%2FPHPOpenAI-Examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EasyGithDev%2FPHPOpenAI-Examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EasyGithDev%2FPHPOpenAI-Examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EasyGithDev","download_url":"https://codeload.github.com/EasyGithDev/PHPOpenAI-Examples/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245334914,"owners_count":20598389,"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","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":[],"created_at":"2024-12-02T09:21:32.793Z","updated_at":"2026-01-05T17:05:16.142Z","avatar_url":"https://github.com/EasyGithDev.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHPOpenAI-Examples\nExamples for the project PHPOpenAI\n\nWelcome to the GitHub project page for \"PHPOpenAI-Examples\", a project that enables the use of the OpenAI API in PHP.\n\nThe main project is hosted here :\n\n[https://github.com/EasyGithDev/PHPOpenAI](https://github.com/EasyGithDev/PHPOpenAI).\n\n## System Requirements\n\nThis project is based on PHP version 8.1 in order to use features such as enumerations. This project does not require any external dependencies. However, you must have the cURL extension installed for it to work properly.\n\n- PHP version \u003e= 8.1\n- cURL extension\n\n## Installation\n\nThe project uses Composer to manage dependencies. If you haven't already installed Composer, you can do so by following the instructions on the official Composer website.\n\n### Github install\n\n#### Clone the project\n\nTo install the project, you can clone it from GitHub using the following Git command:\n\n```bash\ngit clone git@github.com:EasyGithDev/PHPOpenAI-Examples.git\n```\n\n#### Install the project\n\n```bash\ncomposer install\n```\n\n## Writing a first example\n\nTo use the OpenAI API, you need to sign up on their website and obtain an API key. Once you have your API key, you can use it in your PHP code to send requests to the OpenAI API.\n\nHere's an example code that shows you how to use the OpenAI API in PHP:\n\n```php\n\u003c?php\nrequire_once __DIR__ . '/vendor/autoload.php';\n\nuse EasyGithDev\\PHPOpenAI\\Models\\ModelEnum;\nuse EasyGithDev\\PHPOpenAI\\OpenAIApi;\n\n$response = (new OpenAIClient($apiKey))-\u003eCompletion()-\u003ecreate(\n    ModelEnum::TEXT_DAVINCI_003,\n    \"Say this is a test\",\n)-\u003etoObject();\n\n// Response as stClass object\necho '\u003cpre\u003e', print_r($response, true), '\u003c/pre\u003e';\n```\n\nThe full documentation is here :\n[https://github.com/EasyGithDev/PHPOpenAI](https://github.com/EasyGithDev/PHPOpenAI).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feasygithdev%2Fphpopenai-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feasygithdev%2Fphpopenai-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feasygithdev%2Fphpopenai-examples/lists"}