daniilskli/syrve-laravel

Laravel wrapper package for the syrve API

Maintainers

Package info

gitlab.com/DaniilSkLi/syrve-laravel

Issues

pkg:composer/daniilskli/syrve-laravel

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

2.0.0-alpha.6 2026-04-28 08:14 UTC

README

Latest Version on Packagist Total Downloads License

A modern, DTO-powered Laravel wrapper for the Syrve (iiko) API. This package is a fork of the original work by Neverlxsss, updated for modern PHP 8.2+, Laravel 11/12/13, and strictly typed data handling.

⚠️ Version Roadmap & Stability

  • v1.1.2 (Stable): Based on the original logic by Neverlxsss. Recommended for production if you need the full range of Syrve API methods immediately.
  • v2.0.0-alpha.x (Current): This is the stable alpha. The core architecture is solid and production-ready, but not all API methods have been migrated to the new DTO/Strict-typing system yet. Use this if you prefer modern PHP patterns and only need the migrated endpoints (Organizations, Menus).

Features

  • Modern PHP: Full support for PHP 8.2+ features (readonly classes, constructor promotion).
  • Laravel Integration: Facades, Service Providers, and configuration.
  • DTO Powered: All API responses are mapped to immutable Data Transfer Objects.
  • Strict Typing: Static analysis with PHPStan (Level 9).
  • Legacy Bridge: Access original methods via SyrveLegacy while the migration is in progress.

Installation

You can install the package via composer:

composer require "daniilskli/syrve-laravel:^2.0@alpha"

Publish the configuration file:

php artisan vendor:publish --provider="DaniilSkLi\Syrve\SyrveServiceProvider"

Configuration

Add your Syrve credentials to your .env file:

SYRVE_TOKEN=your_api_login
SYRVE_BASE_URL=https://api-eu.syrve.live
SYRVE_TIMEOUT=60

Usage

Modern API (Recommended)

The new implementation uses the Syrve facade and returns DTOs for better IDE completion and type safety.

use DaniilSkLi\Syrve\Facades\Syrve;

// Get all organizations
$response = Syrve::organizations()->getList();
foreach ($response->value as $org) {
    echo $org->name; // OrganizationDto
}

// Get external menus
$menus = Syrve::externalMenus()->getList(correlationId: 'unique-id');

// Get menu details by ID
$menuDetails = Syrve::externalMenus()->byId(
    externalMenuId: 12345,
    organizationIds: ['org-uuid-1'],
    asyncMode: true
);

Legacy API

If you are migrating from the original package, you can use the SyrveLegacy facade or the legacy namespace. This ensures your existing code doesn't break.

use Neverlxsss\Syrve\Facades\Syrve as SyrveLegacy;

$response = SyrveLegacy::organizations(
    returnAdditionalInfo: true, 
    includeDisabled: false
);

if ($response->success()) {
    $data = $response->body();
}

Analysis

For static analysis:

composer lint

Credits

License

The BSD 3-Clause License. Please see License File for more information.