[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-8480":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":21,"hasPages":21,"topics":23,"createdAt":10,"pushedAt":10,"updatedAt":26,"readmeContent":27,"aiSummary":28,"trendingCount":16,"starSnapshotCount":16,"syncStatus":17,"lastSyncTime":29,"discoverSource":30},8480,"laravel","openai-php\u002Flaravel","openai-php","⚡️ OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with OpenAI API","",null,"PHP",3730,263,45,5,0,2,12,29.26,"MIT License",false,"main",[24,5,25],"client","open-ai","2026-06-12 02:01:54","\u003Cp align=\"center\">\n    \u003Cp align=\"center\">\n        \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fopenai-php\u002Flaravel\u002Factions\">\u003Cimg alt=\"GitHub Workflow Status (master)\" src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Factions\u002Fworkflow\u002Fstatus\u002Fopenai-php\u002Flaravel\u002Ftests.yml?branch=main&label=tests&style=round-square\">\u003C\u002Fa>\n        \u003Ca href=\"https:\u002F\u002Fpackagist.org\u002Fpackages\u002Fopenai-php\u002Flaravel\">\u003Cimg alt=\"Total Downloads\" src=\"https:\u002F\u002Fimg.shields.io\u002Fpackagist\u002Fdt\u002Fopenai-php\u002Flaravel\">\u003C\u002Fa>\n        \u003Ca href=\"https:\u002F\u002Fpackagist.org\u002Fpackages\u002Fopenai-php\u002Flaravel\">\u003Cimg alt=\"Latest Version\" src=\"https:\u002F\u002Fimg.shields.io\u002Fpackagist\u002Fv\u002Fopenai-php\u002Flaravel\">\u003C\u002Fa>\n        \u003Ca href=\"https:\u002F\u002Fpackagist.org\u002Fpackages\u002Fopenai-php\u002Flaravel\">\u003Cimg alt=\"License\" src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flicense\u002Fopenai-php\u002Flaravel\">\u003C\u002Fa>\n    \u003C\u002Fp>\n\u003C\u002Fp>\n\n------\n**OpenAI PHP** for Laravel is a community-maintained PHP API client that allows you to interact with the [Open AI API](https:\u002F\u002Fplatform.openai.com\u002Fdocs\u002Fapi-reference\u002Fintroduction). If you or your business relies on this package, it's important to support the developers who have contributed their time and effort to create and maintain this valuable tool:\n\n- Nuno Maduro: **[github.com\u002Fsponsors\u002Fnunomaduro](https:\u002F\u002Fgithub.com\u002Fsponsors\u002Fnunomaduro)**\n- Sandro Gehri: **[github.com\u002Fsponsors\u002Fgehrisandro](https:\u002F\u002Fgithub.com\u002Fsponsors\u002Fgehrisandro)**\n\n> **Note:** This repository contains the integration code of the **OpenAI PHP** for Laravel. If you want to use the **OpenAI PHP** client in a framework-agnostic way, take a look at the [openai-php\u002Fclient](https:\u002F\u002Fgithub.com\u002Fopenai-php\u002Fclient) repository.\n\n\n## Get Started\n\n> **Requires [PHP 8.2+](https:\u002F\u002Fwww.php.net\u002Freleases\u002F)**\n\nFirst, install OpenAI via the [Composer](https:\u002F\u002Fgetcomposer.org\u002F) package manager:\n\n```bash\ncomposer require openai-php\u002Flaravel\n```\n\nNext, execute the install command:\n\n```bash\nphp artisan openai:install\n```\n\nThis will create a `config\u002Fopenai.php` configuration file in your project, which you can modify to your needs\nusing environment variables.\nBlank environment variables for the OpenAI API key and organization id are already appended to your `.env` file.\n\n```env\nOPENAI_API_KEY=sk-...\nOPENAI_ORGANIZATION=org-...\n```\n\nFinally, you may use the `OpenAI` facade to access the OpenAI API:\n\n```php\nuse OpenAI\\Laravel\\Facades\\OpenAI;\n\n$response = OpenAI::responses()->create([\n    'model' => 'gpt-5',\n    'input' => 'Hello!',\n]);\n\necho $response->outputText; \u002F\u002F Hello! How can I assist you today?\n```\n\n## Configuration\n\nConfiguration is done via environment variables or directly in the configuration file (`config\u002Fopenai.php`).\n\n### OpenAI API Key and Organization\n\nSpecify your OpenAI API Key and organization. This will be\nused to authenticate with the OpenAI API - you can find your API key\nand organization on your OpenAI dashboard, at https:\u002F\u002Fopenai.com.\n\n```env\nOPENAI_API_KEY=\nOPENAI_ORGANIZATION=\n```\n\n### OpenAI Project\n\nFor implementations that require a project ID, you can specify \nthe OpenAI project ID in your environment variables.\n\n```env\nOPENAI_PROJECT=proj_...\n```\n\n### OpenAI API Base URL\n\nThe base URL for the OpenAI API. By default, this is set to `api.openai.com\u002Fv1`.\n\n```env\nOPENAI_BASE_URL=\n```\n\n### Request Timeout\n\nThe timeout may be used to specify the maximum number of seconds to wait\nfor a response. By default, the client will time out after 30 seconds.\n\n```env\nOPENAI_REQUEST_TIMEOUT=\n```\n\n## Usage\n\nFor usage examples, take a look at the [openai-php\u002Fclient](https:\u002F\u002Fgithub.com\u002Fopenai-php\u002Fclient) repository.\n\n## Testing\n\nThe `OpenAI` facade comes with a `fake()` method that allows you to fake the API responses.\n\nThe fake responses are returned in the order they are provided to the `fake()` method.\n\nAll responses are having a `fake()` method that allows you to easily create a response object by only providing the parameters relevant for your test case.\n\n```php\nuse OpenAI\\Laravel\\Facades\\OpenAI;\nuse OpenAI\\Responses\\Responses\\CreateResponse;\n\nOpenAI::fake([\n    CreateResponse::fake([\n        'choices' => [\n            [\n                'text' => 'awesome!',\n            ],\n        ],\n    ]),\n]);\n\n$response = OpenAI::responses()->create([\n    'model' => 'gpt-5',\n    'input' => 'PHP is ',\n]);\n\nexpect($response->outputText)->toBe('awesome!');\n```\n\nAfter the requests have been sent there are various methods to ensure that the expected requests were sent:\n\n```php\nuse OpenAI\\Resources\\Responses;\n\n\u002F\u002F assert completion create request was sent\nOpenAI::assertSent(Responses::class, function (string $method, array $parameters): bool {\n    return $method === 'create' &&\n        $parameters['model'] === 'gpt-5' &&\n        $parameters['prompt'] === 'PHP is ';\n});\n```\n\nFor more testing examples, take a look at the [openai-php\u002Fclient](https:\u002F\u002Fgithub.com\u002Fopenai-php\u002Fclient#testing) repository.\n\n---\n\nOpenAI PHP for Laravel is an open-sourced software licensed under the **[MIT license](https:\u002F\u002Fopensource.org\u002Flicenses\u002FMIT)**.\n","openai-php\u002Flaravel 是一个专为 Laravel 框架设计的 PHP API 客户端，旨在简化与 OpenAI API 的交互过程。它支持通过配置文件或环境变量设置 OpenAI API 密钥和组织 ID，并提供了一个简洁易用的 facade 接口来调用 OpenAI 服务，如生成文本、图像等。该库适用于需要在 Laravel 应用中集成 AI 功能的场景，例如构建聊天机器人、内容生成系统或是数据分析工具。其社区维护和支持特性也保证了项目的持续更新和问题响应。","2026-06-11 03:18:15","top_language"]