marcincook/laravel-renteon-api-client
Composer 安装命令:
composer require marcincook/laravel-renteon-api-client
包简介
Laravel client for the Renteon REST API (multi-country, manager-style facade).
README 文档
README
A Laravel client for the Renteon REST API, with first-class support for multi-country setups (PL / ES / LT / …) and a manager-style facade familiar to Laravel developers.
Official Renteon API reference: https://demo.s2.renteon.com/en/Api/Help/Referenceex
Status
🚧 Early development — the API surface may still change before v1.0.0.
Requirements
- PHP 8.3+
- Laravel 11, 12 or 13
Installation
composer require marcincook/laravel-renteon-api-client
Publish the config:
php artisan vendor:publish --tag=renteon-config
Configuration
Set environment variables for each country you operate in:
RENTEON_DEFAULT_COUNTRY=pl RENTEON_PL_API_ENABLED=true RENTEON_PL_API_BASE_URL=https://your-tenant.renteon.com RENTEON_PL_API_USERNAME=... RENTEON_PL_API_PASSWORD=... RENTEON_PL_API_CLIENT_ID=... RENTEON_PL_API_SECRET=... RENTEON_PL_API_SALT=00000000 # Optional — used only by reports (RealizationByOffice et al.) RENTEON_REPORT_TOKEN= RENTEON_REPORT_USERNAME= RENTEON_REPORT_PASSWORD= RENTEON_REPORT_OFFICE_ID=
The same set of variables is available for RENTEON_ES_* and RENTEON_LT_*. Authentication is performed transparently: the first call exchanges your credentials for an access token (POST /token with a Base64(SHA512(…)) signature), then re-uses it for the rest of the request lifecycle.
Quick start
use MarcinCook\RenteonApi\RenteonManager; $renteon = app(RenteonManager::class); // Default country — config('renteon.default') $offices = $renteon->offices()->getOffices(); // Explicit country $cars = $renteon->for('es')->cars()->getAllCars(['IsActive' => true]);
You can also use the Renteon facade:
use Renteon; $countries = Renteon::for('pl')->countries()->getCountries();
Resources
Each resource maps to a slice of the Renteon REST API. Method signatures are kept close to the upstream model names so the official reference is your primary documentation.
| Resource | Key methods |
|---|---|
offices() |
getOffices(bool $onlyActive = true), fetchOfficesFromApi(), clearCache() |
countries() |
getCountries() (projected to {id, name}), clearCache() |
cars() |
searchCars($filters), getAllCars($filters), getCar($id) |
carCategories() |
searchCarCategories($filters), getCarCategory($id) |
services() |
searchServices() — read-only service catalogue (GET /api/ExService/Search). Renteon has no create/update endpoint for services (POST/PUT /api/ExService → 404). |
pricelists() |
getPricelists() — list of pricelists (GET /api/ExPricelist: Id, Code, Name, Currency, …) |
addressBook() |
searchAddressBook($filters), findByEmail($email), getAddressBook($id), createAddressBook($payload), updateAddressBook($id, $payload) |
bookings() |
availability(...), create(...), calculate(...), save(...), getByNumber($number), cancel($number), checkOut($number, $officeCode), searchBookings(...), getBookingsForMonth($y, $m), getBookingById($id) |
carActivities() |
searchCarActivities($filters), getCarActivityDefinitions() |
finance() |
searchFinanceDocuments($filters), searchExportInvoices($filters), findExportInvoiceByInvoiceId($id), getCachedExPaymentTypes(), getCachedExportInvoiceDocumentTypes() |
reports() |
getRealizationByOffice($params) — uses the separate report-token flow |
Booking flow example
The typical "public-facing booking site → Renteon" pipeline looks like this:
use MarcinCook\RenteonApi\RenteonManager; $renteon = app(RenteonManager::class)->for('pl'); // 1) Lookup dictionaries for the storefront (cache these). $offices = $renteon->offices()->getOffices(); $countries = $renteon->countries()->getCountries(); $categories = $renteon->carCategories()->searchCarCategories(['IsActive' => true]); // 2) Identify the customer (email-based lookup). $customer = $renteon->addressBook()->findByEmail('jane@example.com', [ // Optional pre-filter — keeps the search payload small. 'AddressBookTypeIds' => [1], 'IsActive' => true, ]); if ($customer === null) { $customer = $renteon->addressBook()->createAddressBook([ 'Name' => 'Jane Doe', 'AddressBookTypeId' => 1, 'Email' => 'jane@example.com', 'IsAgency' => false, 'IsAgent' => false, 'IsArtisan' => false, 'IsEmployee' => false, 'IsForeigner' => false, 'IsVatPayer' => false, 'AllowB2CAccess' => true, 'BillingDelayInDays' => 0, 'SurveyDoNotEmail' => false, 'AddressBookPhones' => [ ['Number' => '+48123456789', 'PhoneTypeId' => 1], ], ]); } // 3) Check availability for the chosen date window + office pair. $availability = $renteon->bookings()->availability([ 'OfficeOutId' => 1, 'OfficeInId' => 1, 'DateTimeOut' => '2026-06-10T10:00:00+02:00', 'DateTimeIn' => '2026-06-15T10:00:00+02:00', 'AvailableOnly' => true, 'CarCategoryIds' => [/* optionally narrow down */], ]); $pickedCategory = $availability[0]['AvailabilityCarCategories'][0] ?? null; // 4) Create the booking (server computes prices + mandatory additions). $draft = $renteon->bookings()->create([ 'OfficeOutId' => 1, 'OfficeInId' => 1, 'DateTimeOut' => '2026-06-10T10:00:00+02:00', 'DateTimeIn' => '2026-06-15T10:00:00+02:00', 'ClientId' => $customer['Id'], 'BookingTypeId' => 1, 'CurrencyId' => 1, 'AvailabilityCarCategory' => $pickedCategory, ]); // (optional) Recalculate after the customer adds extras / insurance. $draft['Services'][] = ['ServiceId' => 7, 'Quantity' => 1]; $draft = $renteon->bookings()->calculate($draft); // 5) After your payment gateway clears the deposit & extras — persist it. $booking = $renteon->bookings()->save(array_merge($draft, [ 'CarId' => 42, 'ClientId' => $customer['Id'], 'ClientName' => 'Jane Doe', 'ClientEmail' => 'jane@example.com', 'TotalDeposit' => 365.38, 'Remark' => 'Paid online via TPay', ])); // $booking['Number'] is now safe to persist in your local DB for the // customer's booking history.
Verified gotchas (production, confirmed with Renteon)
Hard-won lessons from a live integration — get these wrong and ExBooking/Save
returns an opaque 500 "Nullable object must have a value":
BookingTypeIdmust be2(Reservation), not1(Contract) for a web booking. Type 1 is the single biggest cause of the 500. Pair withBookingSubTypeId = 6(Reservation).- Dates must be UTC Zulu (
2026-06-12T08:00:00Z). An explicit local offset (+02:00) trips a .NETDateTime.Kindconversion error on Create and Save. Saverequires at least oneBooking_Driversentry — without it the server dereferences a null (500). A minimal driver{AddressBookId, SortOrder, IsDriverLicenceDomestic:false, IsPassportDomestic:false, IsIdCardDomestic:false}is enough; the client must have an address book address.Createrequires aPricelistIdon theAvailabilityCarCategory. You may override the amounts (Amount/Total/TotalDeposit) with your own prices, but the category must reference an existing Renteon pricelist.- The client needs ≥1
PersonIdentification(e.g. type 3 = Driver license), or Calculate/Save return 422. - The API user must be a member of the booking's offices (Renteon panel → user → "Offices") or Availability returns 0 categories.
- The
/tokenrequest expectsoffice_id(snake_case) — non-"External" users require it; the External flag is mandatory for machine auth (otherwise a new-device email verification kicks in).
Scope note: this
ExBooking/*(External) API is fine when the CMS owns pricing and overrides amounts. For a Renteon-priced, multi-instance storefront, Renteon recommends the Aggregator API (aggregator.renteon.com, HTTP Basic) instead.
Customer booking history
getBookingsByClient() returns a customer's full history. ClientId is the only
search filter that actually narrows to one customer (ClientIds/AddressBookId
are ignored). The rich export projection (Number, dates, office, car category,
Total/TotalDeposit/TotalDomestic, BookingSubTypeCode, IsCancelled, Client*) is
enough to render a "my bookings" view without a per-booking call.
$history = $renteon->bookings()->getBookingsByClient($clientId);
Email lookup caveat:
AddressBook::findByEmail()is unreliable — Renteon has no email search filter, so it pages the address book and matches client-side and can miss the customer on a large base. Store the RenteonClientIdlocally (per customer) when you create the booking, and look up history by that id.
Reports
Reports::getRealizationByOffice() uses a different authentication flow — set either RENTEON_REPORT_TOKEN (a raw bearer token captured from the Renteon panel) or RENTEON_REPORT_USERNAME/RENTEON_REPORT_PASSWORD/RENTEON_REPORT_OFFICE_ID. If neither is set, the client falls back to the country token.
$rows = $renteon->reports()->getRealizationByOffice([ 'DateTimeInFrom' => '01.06.2026.', 'DateTimeInTo' => '30.06.2026.', 'IncludeExternalDocuments' => false, ]);
Caching
Dictionary endpoints (offices, countries, payment types, document types) are cached using the Laravel cache repository, keyed per country. TTL defaults to 24h and is configurable via RENTEON_DICT_CACHE_TTL (seconds). Use the clearCache() method on each resource to invalidate.
Error handling
All HTTP failures bubble up as exceptions:
MarcinCook\RenteonApi\Exceptions\RenteonAuthException—/tokenendpoint failed or returned noaccess_token.MarcinCook\RenteonApi\Exceptions\RenteonHttpException— any other non-2xx response. The originalIlluminate\Http\Client\Responseis attached as->response.MarcinCook\RenteonApi\Exceptions\RenteonException— base class for both.
The two top-level dictionary getters (getOffices, getCountries) deliberately swallow API failures and log a warning — they're used in dropdowns where a transient outage shouldn't break the page.
Testing
vendor/bin/pest vendor/bin/pint --test
License
MIT — see LICENSE.
marcincook/laravel-renteon-api-client 适用场景与选型建议
marcincook/laravel-renteon-api-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 160 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 05 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「laravel」 「rest-client」 「car-rental」 「renteon」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 marcincook/laravel-renteon-api-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 marcincook/laravel-renteon-api-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 marcincook/laravel-renteon-api-client 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Gentics Mesh PHP Client Library
Simple PHP Rest Client
REST client for PHP 7.4+
A PSR-7 compatible library for making CRUD API endpoints
A PHP library for accessing REST services
PHP client for Dinas Shipping API
统计信息
- 总下载量: 160
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 218
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-05-15