php-skir / client
Laravel SkirRPC client package powered by Saloon.
Requires
- php: ^8.3
- illuminate/contracts: ^10.0|^11.0|^12.0|^13.0
- illuminate/support: ^10.0|^11.0|^12.0|^13.0
- php-skir/runtime: ^0.1@dev
- saloonphp/saloon: ^4.0
- symfony/process: ^6.4|^7.0|^8.0
Requires (Dev)
- laravel/pint: ^1.29
- orchestra/testbench: ^8.0|^9.0|^10.0|^11.0
- phpunit/phpunit: ^10.5|^11.5|^12.5
- spomky-labs/cbor-php: ^3.2
Suggests
- spomky-labs/cbor-php: Required when using SkirClientCodecs::cbor() or SKIR_CLIENT_CODEC=cbor.
This package is auto-updated.
Last update: 2026-07-21 08:57:32 UTC
README
Laravel Skir Client
Laravel package for calling SkirRPC services through generated typed clients and Saloon.
Features
- Generate typed RPC clients from Skir schemas with the client generation guide.
- Use standard PHP objects, Laravel Data, or Simple Data Objects.
- Configure Laravel container resolution and matching wire codecs with the configuration and codecs guide.
- Handle failures and test without network requests.
Quick start
Install the client and standard PHP generator:
composer require php-skir/client npm install --save-dev skir skir-php-generator
Create skir-src/admin/users.skir:
struct GetUserRequest {
user_id: int32;
}
struct User {
user_id: int32;
name: string;
}
method GetUser(GetUserRequest): User = 3180856469;
Configure the root skir.yml:
generators: - mod: skir-php-generator outDir: skir/skirout config: namespace: Skir
Skir owns the output directory and may replace its contents during generation.
Generate the client, configure Composer autoloading, and publish the Laravel config:
npx skir gen npx skir-php-generator configure-composer composer dump-autoload php artisan vendor:publish --tag=skir-client-config
Configure the server endpoint and matching wire codec:
SKIR_CLIENT_BASE_URL=https://api.example.test SKIR_CLIENT_ENDPOINT=/api/skir SKIR_CLIENT_CODEC=dense_json
Call the service through the generated typed client:
use Skir\Admin\GetUserRequest; use Skir\Admin\SkirRpcClient; use Skir\Client\SkirClient as TransportSkirClient; $client = new SkirRpcClient(app(TransportSkirClient::class)); $user = $client->getUser(new GetUserRequest(userId: 42)); echo $user->name;
Generator alternatives
Standard PHP is the dependency-light baseline. Use skir-laravel-data-generator for Laravel Data or skir-simple-data-objects-generator for Simple Data Objects.
