- How do I install rokka/client in a Laravel app?
- Install it with Composer using composer require rokka/client. It is a framework-agnostic PHP client, so you bind it as a singleton in a Laravel service provider and load your Rokka organization and API key from config or environment variables. There is no Laravel auto-discovery, facade, or package config file in version 1.22.0.
- Does rokka/client work with Laravel 10 and Laravel 11?
- It can work with Laravel versions whose PHP and dependency constraints allow PHP ^8.2, guzzlehttp/guzzle ^7.4.5, and PSR-7 v2.4.5 or newer. It is not a Laravel package, so you must add your own service provider binding and configuration. Older Laravel applications pinned to PHP 8.0 or 8.1 or Guzzle 6 will need upgrades first.
- What PHP and Guzzle versions does rokka/client 1.22.0 require?
- Version 1.22.0 requires PHP ^8.2, guzzlehttp/guzzle ^7.4.5, and guzzlehttp/psr7 ^2.4.5. It drops PHP 8.0 and 8.1 support as well as Guzzle 6, so check your full Composer dependency graph for PSR-7 v2 compatibility. The client also supports PSR-18 and PSR-17 HTTP client integration.
- How do I upload an image and generate a Rokka URL in Laravel?
- Use the client to upload the source image, then store the returned hash or alias as your application reference. Generate delivery URLs through Rokka stacks and operations, using the provided URI helper where appropriate. Keep the Rokka client behind an application service and expose only URL view models or helpers to controllers and Blade templates.
- How do I generate dynamic image URLs with stacks and operations?
- Rokka URLs are built from stack names and stack options, and the client can create, update, and delete stacks and aliases. You can use listStackOptions to validate stack option payloads before sending them. For signing, prefer local UriHelper::signUrl over signUrlOnServer when you want to avoid an extra network round trip.
- How does rokka/client handle errors and exceptions?
- The client provides typed responses and exceptions for reliable error handling. Catch Rokka-specific exceptions in your application service, log the details, and translate them into your own domain errors rather than leaking API responses to users. Because it supports PSR-18 clients, you can inject test doubles for error-path testing.
- Are deleteSourceImageCache and deleteStackCache dangerous?
- Yes, these are destructive, paid operations, and a wildcard stack cache purge can affect a whole organization if misconfigured. Restrict them to privileged services and add a policy or whitelist layer so normal application code cannot call them. Also treat keepHash carefully, because it can deliberately serve stale renders until you purge or version the cache.
- How do I manage source image aliases and renames with rokka/client?
- Version 1.22.0 adds SourceImageAlias support and alias CRUD, letting you use stable, human-readable references instead of relying only on hashes. Define your alias naming convention in application config and own the mapping between aliases and your product records. Renames can affect references, so update your mapping and cache expectations when source images are renamed.
- How can I test a Laravel integration with rokka/client without hitting the API?
- Use MockHandler-based tests or a fake PSR-18 HTTP client, then bind that fake in the Laravel container in place of the real Rokka client. Cover upload flows, alias lifecycle, URL generation, cache purge authorization, and ZIP download behavior. Keep a small set of integration tests against a non-production Rokka organization for the operations that matter most.
- Is rokka/client a good alternative to Cloudinary or imgix for Laravel?
- It is the official PHP client for Rokka, not a drop-in replacement SDK for Cloudinary or imgix, and it still needs a thin Laravel wrapper around configuration, credentials, and service bindings. Evaluate Rokka's SLA, pricing, rate limits, and which features such as cache purge, ZIP export, and URL signing are paid. It is a strong fit if Rokka is your strategic media backend, but simpler resizing needs may favor another service.