Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Chatgpt Laravel Package

naif/chatgpt

A Laravel package that integrates OpenAI's ChatGPT API into your PHP applications, offering a simple wrapper for sending prompts and receiving AI-generated responses. Note: limited documentation and low adoption, so review the source before production use.

View on GitHub
Deep Wiki
Context7

naif/chatgpt is a lightweight Laravel package that brings OpenAI ChatGPT into your PHP application through a simple, expressive interface. It handles API configuration and request building so you can send prompts and receive conversational responses without boilerplate.

  • Laravel-ready configuration for API keys and defaults
  • Chat completion requests with prompt/message support
  • Fluent, readable API for quick integration
  • Response handling for easy use in controllers/services
  • Extensible structure for custom endpoints and models
Frequently asked questions about Chatgpt
Do I need Laravel Nova to use naif/chatgpt?
Yes. Despite being described as a Laravel/PHP ChatGPT wrapper, this package is implemented as a Laravel Nova tool, so Nova must already be installed and licensed in your application. It registers inside NovaServiceProvider and surfaces a prompt-and-response interface within the Nova admin panel. If you do not use Nova as your internal admin surface, this package is not a fit and you should look at a general-purpose OpenAI client instead.
How do I install naif/chatgpt in a Laravel application?
Install it with Composer, publish the package configuration and migrations, then register the tool in your NovaServiceProvider. After that, set your OpenAI API key in the published config or environment file and run the migrations to create the table that stores prompts and responses. Review the published migration before running it in any shared environment to avoid naming collisions with existing tables.
Where does naif/chatgpt store the OpenAI API key?
The key is supplied through the package configuration file, which in typical Laravel practice reads from an environment variable. You should externalize it using your standard secrets management approach rather than committing it to source control. Because the tool calls OpenAI synchronously from the admin panel, treat the key as a production credential and restrict who can access the Nova tool.
Which Laravel, PHP, and Nova versions are supported by naif/chatgpt?
Version constraints are defined in the package composer.json, and the last release was November 2024, so you must verify compatibility against your specific Laravel, PHP, and Nova versions rather than assuming it. Community adoption is negligible, which means there is little evidence of edge cases or version compatibility in the wild. Prove it in a staging Nova instance before committing, and check that it works with your Nova authorization and tenancy patterns.
Does naif/chatgpt save prompts and responses to the database?
Yes. The package publishes migrations that create a database-backed log of the questions you send and the answers ChatGPT returns. That is useful for internal knowledge capture and audit-style review, but it also means prompt content and model output are persisted in your application database. Define a data classification and retention policy before using it with anything sensitive, since the package offers limited redaction or cleanup tooling.
Can I use naif/chatgpt to build a customer-facing chatbot or streaming chat UI?
No. It is a narrow Nova admin tool, not a chat platform: there is no streaming UX, no multi-tenant conversation management, and no API-first interface for front-end consumers. Requests are made synchronously, which can block an admin request while waiting on OpenAI. For customer-facing chat you should build a dedicated service layer on top of the official OpenAI PHP client instead.
How do I test naif/chatgpt safely without leaking data or burning tokens?
Start with a staging Nova instance that is not connected to production data, and test only with non-sensitive prompts. Externalize the API key through environment or secrets management, and keep an eye on token usage and spend while you exercise the tool. Validate failure modes explicitly: missing key, OpenAI outage, rate limit, timeout, and migration rollback. If the pilot succeeds, promote it as an internal-only Nova tool with a documented retention policy.
What happens if the OpenAI API key is invalid or OpenAI rate limits my requests?
The package is a thin convenience wrapper, so guardrails for rate limiting, cost caps, retries, and graceful failure handling are limited. Because calls are synchronous, a slow or failing OpenAI response can stall the Nova request rather than degrade cleanly. Plan to test these failure modes yourself in staging and add your own monitoring, usage caps, and error surfacing before wider rollout.
Is naif/chatgpt actively maintained and safe to depend on in production?
The project has a single maintainer, around three stars, and zero dependents, so there is very little community battle-testing behind it. The realistic risks are maintainer abandonment, incompatibility with future Laravel, Nova, or OpenAI API changes, uncontrolled token spend, and sensitive prompt data persisted in your database. Treat it as an internal productivity tool or prototype, and only adopt it if your team is prepared to fork and maintain it.
What are the alternatives to naif/chatgpt for ChatGPT integration in Laravel?
The most common alternative is the official openai-php/client library, either wrapped in a small custom Nova tool or used inside a dedicated service layer with queue-based processing. A custom tool gives you control over authorization, redaction, retention, cost caps, and failure handling that this package does not provide. Given the package's small footprint, a thin internal replacement is often less work than forking and maintaining upstream.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections