Download the PHP package phpdevkits/forge-sdk without Composer
On this page you can find all versions of the php package phpdevkits/forge-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download phpdevkits/forge-sdk
More information about phpdevkits/forge-sdk
Files in phpdevkits/forge-sdk
Package forge-sdk
Short Description PHP SDK for Laravel Forge — a modern, type-safe client for the Forge API, built on Saloon.
License MIT
Informations about the package forge-sdk
Forge SDK
Forge SDK is an ultra-strict, type-safe PHP client for the Laravel Forge API, built on Saloon v3. It is engineered for developers who want to automate their Forge infrastructure with the same rigor they apply to their application code — fully typed, immutable, and fail-fast.
Why This SDK?
The Forge API is JSON:API with cursor pagination, async endpoints, and more than a few places where the documented schema and the live behavior disagree. This SDK absorbs all of that so you don't have to:
- 100% Type Coverage: Every method, property, and parameter is explicitly typed — no
mixed, no array soup. - Immutable, hydrated DTOs: Responses become
final readonlyobjects (Server,Site,Deployment, …) with typed fields andDateTimeImmutabledates, not loose arrays. - Fail-fast, typed exceptions: Every non-2xx response throws a specific exception (
ValidationException,NotFoundException,RateLimitException, …) so errors surface at the call site, never silently. - Pagination that gets out of your way: Cursor pagination is wrapped in
Page<T>with a lazyiterate()that walks every page for you. - Framework-agnostic: No Laravel required. It's plain Saloon — drop it into any PHP 8.4+ project.
- Battle-tested against the real API: 100% test coverage, with every fixture recorded against live Forge and scrubbed of PII.
Spec-vs-runtime divergences we've hit (and how the SDK handles them) are catalogued in docs/FINDINGS.md.
Getting Started
Requires PHP 8.4+.
Install via Composer:
Grab a personal access token from your Forge API settings, then build a Forge client one of three ways:
The forge.json shape:
Usage
The authenticated user, organizations, and the provider catalog
Organization context
Org-scoped resources read the organization from the constructor / env / config, or you can switch context per call with an immutable clone:
Calling an org-scoped resource with no organization set throws OrganizationNotSetException.
Servers
Sites & deployments
SSH keys & daemons
Pagination
Every collection exposes all(?Options) for a single Page<T> and iterate(?Options) for a lazy Generator across all pages:
Testing your own code
It's Saloon underneath, so you can fake Forge in your own suite without touching the network:
Tracks the Forge API while it is
v0.x— minor versions of this SDK may include breaking changes until1.0.
Development
Contributing
Pull requests are welcome — please open an issue first for anything non-trivial so we can agree on the shape.
License
Forge SDK was created by Francisco Barrento under the MIT license.