{"id":20737094,"url":"https://github.com/phpexpertsinc/chatgptspeaker","last_synced_at":"2025-10-12T18:13:58.607Z","repository":{"id":224733025,"uuid":"764092334","full_name":"PHPExpertsInc/ChatGPTSpeaker","owner":"PHPExpertsInc","description":"A quick and easy extension for effortlessly handling OpenAI's API for ChatGPT.","archived":false,"fork":false,"pushed_at":"2024-02-28T15:18:02.000Z","size":18,"stargazers_count":3,"open_issues_count":9,"forks_count":1,"subscribers_count":2,"default_branch":"trunk","last_synced_at":"2025-08-04T07:05:44.688Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PHPExpertsInc.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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,"zenodo":null}},"created_at":"2024-02-27T13:18:46.000Z","updated_at":"2024-02-27T18:42:08.000Z","dependencies_parsed_at":"2025-04-24T01:42:01.752Z","dependency_job_id":"103df9f8-3aa0-4216-973b-7bd477902285","html_url":"https://github.com/PHPExpertsInc/ChatGPTSpeaker","commit_stats":null,"previous_names":["phpexpertsinc/chatgptspeaker"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/PHPExpertsInc/ChatGPTSpeaker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHPExpertsInc%2FChatGPTSpeaker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHPExpertsInc%2FChatGPTSpeaker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHPExpertsInc%2FChatGPTSpeaker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHPExpertsInc%2FChatGPTSpeaker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PHPExpertsInc","download_url":"https://codeload.github.com/PHPExpertsInc/ChatGPTSpeaker/tar.gz/refs/heads/trunk","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHPExpertsInc%2FChatGPTSpeaker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279012502,"owners_count":26085133,"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-12T02:00:06.719Z","response_time":53,"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":[],"created_at":"2024-11-17T06:13:32.513Z","updated_at":"2025-10-12T18:13:58.578Z","avatar_url":"https://github.com/PHPExpertsInc.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ChatGPTSpeaker\n\n[![Maintainability](https://api.codeclimate.com/v1/badges/ba05b5ebfa6bb211619e/maintainability)](https://codeclimate.com/github/phpexpertsinc/RESTSpeaker/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/ba05b5ebfa6bb211619e/test_coverage)](https://codeclimate.com/github/phpexpertsinc/RESTSpeaker/test_coverage)\n\nChatGPTSpeaker is a PHP Experts, Inc., Project meant to ease the accessing of the OpenAI APIs.\n\nThis library uses [RESTSpeaker](https://packagist.org/package/phpexperts/rest-speaker)\nto utilize the Guzzle HTTP Client via the Composition architectural pattern.\n\nYou might be very interested in the projects that used by and/or adjacent to this project:\n\n* **PHP Evolver**\n    * `composer require phpexperts/evolver` \n    * One of only two Genetic Algorithm (GA) libraries for PHP, but very easy to use.\n    * One of the few AI / Machine Learning libraries for PHP.\n    * https://github.com/PHPExpertsInc/php-evolver\n* **RESTSpeaker**\n    * `composer require phpexperts/rest-speaker`\n    * A very easy way to consume REST APIs. Built on top of Guzzle but with a much better interface.\n    * https://github.com/PHPExpertsInc/RESTSpeaker\n* **SimpleDTO**\n    * `composer require phpexperts/simple-dto`\n    * Easily build validating DTOs for PHP 7.2+.\n    * https://github.com/PHPExpertsInc/SimpleDTO\n\n## Installation\n\nVia Composer\n\n```bash\ncomposer require phpexperts/chatgpt-speaker\n```\n\nCopy `.env.example` to `.env` in your project's root directory and put in your OpenAI credentials.\n\n\n## Change log\n\nPlease see the [changelog](CHANGELOG.md) for more information on what has changed recently.\n\n## Usage\n\nBy default, JSON results are returned.\n\n```php\n    $chatGPT = new ChatGPTSpeaker();\n\n    $prompt = \u003c\u003c\u003cPROMPT\n    Please create a table of the PHP major version releases along with the date of release.\n    PROMPT;\n    $response = $chatGPT-\u003eprompt($prompt);\n```\n\nResponse:\n```JSON\n{\n  \"model\": \"gpt-3.5-turbo\",\n  \"messages\": {\n    \"0\": {\n      \"role\": \"user\",\n      \"content\": \"format responses in JSON\"\n    },\n    \"1\": {\n      \"role\": \"user\",\n      \"content\": \"    Please create a table of the PHP major version releases along with the date of release.\"\n    },\n    \"role\": \"assistant\",\n    \"content\": {\n      \"php_major_version_releases\": [\n        {\n          \"version\": \"PHP 3\",\n          \"release_date\": \"June 6, 1998\"\n        },\n        {\n          \"version\": \"PHP 4\",\n          \"release_date\": \"May 22, 2000\"\n        },\n        {\n          \"version\": \"PHP 5\",\n          \"release_date\": \"July 13, 2004\"\n        },\n        {\n          \"version\": \"PHP 6\",\n          \"release_date\": \"No official release\"\n        },\n        {\n          \"version\": \"PHP 7\",\n          \"release_date\": \"December 3, 2015\"\n        },\n        {\n          \"version\": \"PHP 8\",\n          \"release_date\": \"November 26, 2020\"\n        }\n      ]\n    }\n  }\n}\n\n```\nTo get the same basic results as the ChatGPT user interface, do the following:\n\n```php\n    $chatGPT = new ChatGPTSpeaker();\n    $chatGPT-\u003ereturnText();\n\n    $prompt = \u003c\u003c\u003cPROMPT\n        Please create a table of the PHP major version releases along with the date of release.\n    PROMPT;\n    $response = $chatGPT-\u003eprompt($prompt);\n\n \n```\n\n(From RESTSpeaker) To convert the RESTSpeaker API request into a `curl` CLI command, do this:\n\n```shell\ncomposer require --dev octoper/cuzzle\n```\n```php\n$curlCLI = $chatGPT-\u003eapi-\u003ehttp-\u003etestHandler-\u003egetRecords()[0];\n\nOutput: \ncurl 'https://api.openai.com/v1/chat/completions' -A 'PHPExperts/RESTSpeaker-2.4 (PHP 8.3.3)' \\\n   -H 'Content-Type: application/json'  -H 'Authorization: Bearer [redacted]' \\ \n   -X POST  -d '{\"model\":\"gpt-3.5-turbo\",\"messages\":[{\"role\":\"user\",\"content\":\"Say 'Hello, World!'.\"}]}'\n```\n\n(From RESTSpeaker) To get the raw payload as returned by api.openai.com:\n\n```php\n$rawReturn = (string)$chatGPT-\u003eapi-\u003egetLastResponse()-\u003egetBody();\n```\n\n# Use cases\n\n ✔ Returns the same responses as chat.openai.com.\n\n## Testing\n\n```bash\nphpunit\n```\n\n# Roadmap\n\n* Implement the Models endpoint\n* Implement the Images endpoints\n* Implement the Files endpoint\n* Implement the Audio endpoints\n* Implement the new Embeddings endpoints for AI Model Training\n* Implement the new Fine Tunings Endpoints for custom GPT Agents\n* Implement the Moderations endpoint\n* Implement support for the GPT5 Agents\n\n# Contributors\n\n[Theodore R. Smith](https://www.phpexperts.pro/]) \u003ctheodore@phpexperts.pro\u003e  \nGPG Fingerprint: 4BF8 2613 1C34 87AC D28F  2AD8 EB24 A91D D612 5690  \nCEO: PHP Experts, Inc.\n\n## License\n\n**CC-BY-ND-4.0**\nCreative Commons NoDerivations v4.0: Please see the [license file](LICENSE) for more information.\n\n**YOU MAY FORK THIS PROJECT.**\n\n**YOU MAY NOT PUBLISH ANY DERIVATION of this project to either your own website or a third-party host.**\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpexpertsinc%2Fchatgptspeaker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphpexpertsinc%2Fchatgptspeaker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpexpertsinc%2Fchatgptspeaker/lists"}