Search by

php-skir / client

happyDemon

Laravel SkirRPC client package powered by Saloon.

Package info

github.com/php-skir/client

pkg:composer/php-skir/client

Statistics

Installs: 24

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

v0.2.1 2026-11-11 14:22 UTC

This package is auto-updated.

Last update: 2026-11-11 14:24:46 UTC


README

Laravel Skir Client

Laravel Skir Client

Tests Coverage Composer PHP License

Call SkirRPC services from Laravel through generated, typed PHP clients. Requests go out over Saloon using the standard SkirRPC protocol, so the server can be php-skir/server or a Skir service written in any other language.

Requirements: PHP 8.3+, Laravel 12 or 13, and Node.js for the Skir compiler.

Features

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                               # or: php artisan skir:generate-client
npx skir-php-generator configure-composer
composer dump-autoload
php artisan vendor:publish --tag=skir-client-config

Configure the server endpoint:

SKIR_CLIENT_BASE_URL=https://api.example.test
SKIR_CLIENT_ENDPOINT=/api/skir

If the server expects a credential, configure it in the same file. For example, to send a shared secret in a custom header:

SKIR_CLIENT_AUTH_TYPE=header
SKIR_CLIENT_AUTH_HEADER=X-Internal-Token
SKIR_CLIENT_AUTH_TOKEN=your-shared-secret

Every request then carries X-Internal-Token: your-shared-secret. Bearer, basic, and custom authentication are covered in the configuration guide.

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.

Documentation