openai-php

openai-php/laravel

PHP MIT AI & ML

⚡️ OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with OpenAI API

3.7k stars
264 forks
recent
GitHub +4 / week

3.7k

Stars

264

Forks

14

Open issues

22

Contributors

v0.20.0 15 Jun 2026

AI Analysis

OpenAI PHP for Laravel is a Laravel-integrated PHP API client that provides a facade-based interface to interact with OpenAI's API. It serves Laravel developers who need seamless OpenAI integration within their applications; it is not suitable for framework-agnostic PHP projects (which should use the base openai-php/client instead).

AI & ML Library Discovery value: 4/10
Documentation 7/10
Activity 8/10
Community 8/10
Code quality 7/10

Inferred from signals mentioned in the README (tests, CI, type safety) — not a review of the actual code.

Overall score 8/10

AI's overall editorial judgment — not an average of the bars above, can weigh other factors too.

openai-api laravel-integration php-client llm-integration api-wrapper
Actively maintained MIT licensed Niche/specialized use case Beginner friendly Production ready
Deep Analysis · Based on README and public signals
6d ago

Laravel-native OpenAI PHP client: framework integration layer over established base library

OpenAI PHP for Laravel is a Laravel-specific wrapper around the framework-agnostic openai-php/client library. It provides Facade-based access, configuration management, and testing helpers tailored to Laravel's conventions. Primary audience: Laravel developers building AI features. Adoption is moderate relative to Laravel's scale; adoption is verified through Packagist download metrics but exact production usage remains undocumented.

Origin

Created December 2022 during the initial wave of OpenAI API adoption. Maintained by Nuno Maduro and Sandro Gehri, both active in the PHP open source community. Positioned explicitly as a framework-integration layer over the standalone openai-php/client, released approximately 4 weeks after ChatGPT public launch.

Growth

Steady, modest growth since launch. 3,739 stars and 263 forks indicate niche-but-engaged adoption. Recent activity (last push 30 June 2026, 7 stars gained in last 7 days) suggests active maintenance but not viral expansion. Growth appears driven by Laravel ecosystem adoption rather than market saturation—reflects the size and maturity of the Laravel community rather than rapid conversion of new users.

In production

Packagist download metrics referenced but exact numbers not provided in metadata. GitHub stars (3,739) and fork count (263) suggest adoption in single-digit thousands of projects, likely concentrated in Laravel ecosystem. No documented case studies, company endorsements, or large-scale production deployments mentioned in README. Adoption not verified beyond proxy metrics.

Code analysis
Architecture

Likely implements Laravel Service Provider pattern for registration, Facade for API access, and custom configuration publishing via artisan commands. Appears to delegate core API logic to openai-php/client and focus on Laravel-specific integration (dependency injection, config management, testing mocking). Not inspected directly; inferred from README.

Tests

README explicitly documents testing via `OpenAI::fake()` method with request assertion helpers (e.g., `OpenAI::assertSent()`). Indicates mature testing story. GitHub Actions badge shown; actual coverage percentage not documented in excerpt.

Maintenance

Last push 30 June 2026 (4 days before analysis date). Tests workflow badge present and presumably passing. No evidence of maintenance burden issues; appears to receive regular updates. Activity level consistent with a mature, stable package rather than actively expanding feature set.

Honest verdict

ADOPT IF: you are building with Laravel and need straightforward access to OpenAI API with minimal boilerplate; you prefer Facade-based access and Laravel config conventions; you want a well-tested, framework-integrated solution. AVOID IF: you need to stay framework-agnostic (use openai-php/client instead); you require higher-level AI abstractions (consider laravel/ai); your project is not Laravel-based. MONITOR IF: laravel/ai (official package) gains features that overlap; if you are building multi-framework AI tooling, watch whether Laravel's official stance shifts toward centralizing on laravel/ai rather than third-party integrations.

Independent dimensions

Mainstream potential

3/10

Technical importance

5/10

Adoption evidence

4/10

Risks
  • Dependency on openai-php/client—changes in upstream library could require adapter updates; no evidence of how quickly laravel package follows upstream releases.
  • Laravel ecosystem fragmentation: laravel/ai (official) competes for mindshare and may eventually be preferred by organizations standardizing on first-party packages.
  • No documented SLA or corporate backing; maintenance depends on volunteer effort from Nuno Maduro and Sandro Gehri. Burnout or availability changes could pause updates.
  • Adoption appears narrowly concentrated in Laravel community; no evidence of use outside Laravel, limiting potential for cross-project collaboration or ecosystem leverage.
  • OpenAI API breaking changes or deprecations would require rapid coordinated updates across both openai-php/client and this package; unclear how quickly this occurs in practice.
Prediction

Likely to remain a stable, niche-focused Laravel integration indefinitely. Not expected to dominate even within Laravel; may face gradual pressure from laravel/ai if Laravel community rallies around official solutions. Most probable outcome: slow steady-state maintenance with periodic updates to track OpenAI API changes, serving existing Laravel projects without significant new user acquisition.

0 found this helpful

Newsletter

Get analyses like this every Monday

Free weekly digest of the most interesting open-source discoveries.

Languages

PHP
99.9%
Hack
0.1%

Information

Language
PHP
License
MIT
Last updated
2w ago
Created
43mo ago
Analyzed with
anthropic/claude-haiku-4-5

Stars over time

Loading…

Contributors over time

Top 100 contributors only — repos with more will plateau at 100.

Loading…

Similar repos

openai-php

openai-php/client

OpenAI PHP is a community-maintained API client enabling PHP developers to...

5.8k PHP
laravel

laravel/ai

Laravel AI is a unified SDK for PHP developers to interact with multiple AI...

1k PHP AI & ML
openai

openai/openai-python

The official Python client library for the OpenAI API, providing convenient...

31.1k Python AI & ML
prism-php

prism-php/prism

Prism is a Laravel package that provides a unified, fluent interface for...

2.4k PHP AI & ML
vs. alternatives
openai-php/client

Parent library; framework-agnostic, lower-level. Laravel is built on top of this. More stars (5,805) but requires manual integration. Tradeoff: client is portable, Laravel adds convenience.

laravel/ai

Official Laravel package for AI abstractions. Fewer stars (1,028) but may offer higher-level abstractions and official support. Direct competitor for Laravel-native use cases; laravel/ai may encourage standardization around Laravel's own AI layer.

prism-php/prism

Broader PHP AI client abstraction layer (2,399 stars). Vendor-agnostic wrapper. Requires manual Laravel integration; openai-php/laravel is more opinionated but Laravel-specific.

openai/openai-python

Python equivalent. Not competitive in PHP ecosystem but indicates relative scale: OpenAI's own Python client has 31k stars. PHP ecosystem is smaller; Laravel subset is smaller still.