- How do I install toshy/bunnynet-php in a Laravel application?
- Install it with Composer using composer require toshy/bunnynet-php, then confirm the package's PHP and PSR-18 constraints against your runtime. There is no first-party Laravel service provider, so you will add a small provider of your own that binds configuration and a singleton client. Keep credentials in environment variables or your secret manager rather than committing a config default.
- Does toshy/bunnynet-php include a Laravel service provider?
- No, the package is framework-agnostic and does not ship a first-party Laravel provider. You typically write roughly 40 lines covering a config file, an env-backed credential binding, and a container singleton. That small wrapper is also the right place to bind the SDK behind your own CdnPurgeService or EdgeStorageGateway interface.
- Which Laravel and PHP versions does this Bunny.net SDK support?
- The package is aimed at modern PHP, with PHP 8.1 or newer being the practical baseline for a Laravel 10 through 12 integration. There is no official Laravel version matrix because the package does not depend on the framework directly. Always verify the composer.json PHP constraint before adopting it, since that constraint can affect your runtime upgrade path.
- What Bunny.net features does toshy/bunnynet-php cover?
- The SDK wraps Bunny.net REST resources such as pull zones, storage zones, cache purge, DNS, and statistics. Coverage is broad but likely partial, so confirm that the exact endpoints you need are implemented. Pay particular attention to purge by URL or tag, storage upload, signed URLs, and statistics before committing to the package.
- How should I handle errors from the Bunny.net API in a Laravel app?
- First check whether the SDK exposes typed exceptions and DTOs or returns raw PSR-7 responses you must parse yourself. In either case, catch SDK exceptions inside your adapter and translate them into domain-specific exceptions your application understands. Log the Bunny request identifier or correlation ID where available, and avoid leaking vendor response objects into controllers or jobs.
- Will toshy/bunnynet-php work with my existing Guzzle middleware, retries, and timeouts?
- The SDK is built around PSR-18, PSR-17, and PSR-7 and builds on Guzzle, which Laravel already ships. PSR-18 client discovery may create its own client, so explicitly inject your configured Guzzle client if you need retry, logging, proxy, or timeout middleware to apply. Verify this in staging to avoid accidentally running two HTTP stacks with different behaviour.
- Can I call Bunny.net endpoints that the SDK does not wrap?
- Check the source for a raw-request escape hatch that lets you issue arbitrary Bunny.net API calls through the same authenticated client. If one is not available, fall back to a direct PSR-18 request from inside your adapter rather than bypassing the adapter at call sites. That keeps unwrapped endpoints contained and makes a future swap to direct REST calls straightforward.
- How do I test Bunny.net CDN integration without hitting the real API?
- Bind your own CachePurger or EdgeStorageGateway interface to a null or fake implementation in local and test environments. For adapter-level tests, mock the PSR-18 HTTP client and assert the requests and headers your code produces. Keep a small staging spike that performs a real purge call so you validate credentials and endpoint behaviour without making the main test suite network-dependent.
- Is toshy/bunnynet-php safe to use in production?
- The MIT license is clean for commercial use, and the Guzzle and PSR foundation is familiar to Laravel teams. The main risk is that this is a single-maintainer community package with a small contributor base and no vendor SLA, and repository provenance is not verified in the package metadata. Pin an exact version, commit the lockfile, review the upstream source and release history, and isolate the SDK behind your own interface so it can be replaced.
- What is the best way to add Bunny.net CDN purge to Laravel?
- Introduce a CachePurger interface with a null implementation for local and test environments, then bind the Bunny SDK adapter behind it. Dispatch a queued purge job on content publish and unpublish events, with retries, metrics, and clear failure logging. Roll it out gradually and use cache-hit-ratio and purge-success dashboards before expanding the package to storage, pull-zone, or DNS operations.