grok-php/laravel
Laravel integration for the GrokPHP client. Add Grok AI chat and vision to Laravel apps with a clean facade API, configurable defaults (model, temperature, timeout), streaming responses, and simple install via artisan. Supports Laravel 10–12, PHP 8.2+.
Architecture fit: The package integrates seamlessly with Laravel's service container and facade pattern, providing idiomatic Laravel syntax (GrokAI::chat(), GrokAI::vision()) and config-driven setup. It leverages Laravel's dependency injection for service binding and follows PSR standards for clean separation of concerns. The dependency on grok-php/client creates a well-defined layering where Laravel-specific concerns (config, service provider) are abstracted from core API interactions.
Integration feasibility: High feasibility for Laravel 10+ projects. Installation is trivial via Composer and artisan command (php artisan grok:install), which auto-publishes config and .env variables. The facade-based API requires minimal boilerplate code for common use cases (chat/vision), with clear examples in documentation. However, absence of built-in caching, retry logic, or rate-limiting handling in the package may require custom application-level implementation for production workloads.
Technical risk: Moderate risk due to low adoption metrics (163 stars, 0 dependents) and limited third-party validation. The package depends on an unverified upstream client (grok-php/client), which has no public metrics or documentation in the provided materials. Security vulnerability reporting relies solely on a personal email (thefeqy@gmail.com) rather than GitHub's security advisories, raising concerns about vulnerability response maturity. PHP 8.2+ requirement excludes legacy environments, and vision model support appears limited to specific experimental Grok versions without clear version compatibility guarantees.
Key questions:
grok-php/client updated relative to Grok API changes?Stack fit: Ideal for modern Laravel stacks (10-12) with PHP 8.2+. The package's dependency on Laravel's service container and config system ensures compatibility with standard Laravel patterns (e.g., service providers, env variables). It complements common Laravel patterns like repository layers (for API abstraction) and middleware (for authentication/authorization of AI requests). However, it lacks built-in integration with Laravel-specific tools like Horizon for job queuing or Telescope for debugging, requiring manual implementation.
Migration path: Zero migration complexity for new projects. For existing projects:
composer require grok-php/laravel)php artisan grok:install to generate config and .env templateGrokAI facade usage
No legacy code cleanup is needed since it's a new integration point.Compatibility: Fully compatible with Laravel 10, 11, and 12. Requires PHP 8.2+ (no PHP 8.1 support). No known conflicts with common Laravel packages (e.g., Sanctum, Breeze) based on provided docs. However, compatibility with non-standard HTTP clients (e.g
How can I help you explore Laravel packages today?