oleksyuk / apaleo-bundle
Symfony bundle for integrating the Apaleo hotel PMS API SDK
Package info
github.com/maks-oleksyuk/apaleo-bundle
Type:symfony-bundle
pkg:composer/oleksyuk/apaleo-bundle
Requires
- php: ^8.4
- nyholm/psr7: ^1.8.2
- oleksyuk/apaleo-php: dev-main
- symfony/cache: ^8.0
- symfony/config: ^8.0
- symfony/dependency-injection: ^8.0
- symfony/http-client: ^8.0
- symfony/http-kernel: ^8.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.95.27
- phpstan/phpstan: ^2.2.14
- phpunit/phpunit: ^13.3.4
- rector/rector: ^2.6.7
- symfony/framework-bundle: ^8.0
Suggests
- symfony/framework-bundle: Profiler HTTP Client panel for Apaleo calls, framework.yaml overrides for its HTTP client, and cache.app as the default token cache
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-09-22 21:15:37 UTC
README
apaleo-bundle
Symfony bundle for apaleo-php — the framework-agnostic PHP SDK for the Apaleo hotel PMS API.
Installation
composer require oleksyuk/apaleo-bundle
Register the bundle in config/bundles.php (Flex would do this automatically for a published recipe; do it by hand for now):
return [ // ... Oleksyuk\Apaleo\Bundle\ApaleoBundle::class => ['all' => true], ];
Configuration
Add your Apaleo API credentials to .env.local (never commit real secrets to .env):
APALEO_CLIENT_ID=your-client-id APALEO_CLIENT_SECRET=your-client-secret
These are the defaults the bundle reads (%env(APALEO_CLIENT_ID)% / %env(APALEO_CLIENT_SECRET)%). Override them, or set a custom base URI (e.g. a sandbox environment), via config/packages/apaleo.yaml:
apaleo: client_id: '%env(APALEO_CLIENT_ID)%' client_secret: '%env(APALEO_CLIENT_SECRET)%' # base_uri: 'https://api.sandbox.apaleo.com' # optional, defaults to https://api.apaleo.com # token_cache: cache.redis # optional PSR-6 pool for the access token, defaults to cache.app # identity_base_uri: 'http://localhost:8080' # optional, defaults to https://identity.apaleo.com
FrameworkBundle is optional. Without it, the bundle still wires its own HTTP client with the same timeout and retries, but the access token is cached in memory only (a new token per PHP-FPM request) unless token_cache points at a pool.
Run bin/console config:dump-reference apaleo at any time to see the full, current config tree.
Usage
Inject ApaleoClient like any other autowired service:
use Oleksyuk\Apaleo\ApaleoClient; final class PropertyController { public function __construct(private readonly ApaleoClient $apaleo) {} public function list(): Response { $properties = $this->apaleo->inventory()->properties()->list(); // ... } }
See the apaleo-php README for the full SDK API (Inventory resources, pagination, filters, exceptions).
HTTP client, timeouts and retries
The bundle registers a scoped client, apaleo.http_client, for every call the SDK makes (API and identity server). It defaults to a 10 s timeout and 2 retries: 429 is always retried (honoring Retry-After), and 5xx/transport errors only for GET/HEAD, because a 502 after a POST may still have been applied. With FrameworkBundle, these calls show up under apaleo.http_client in the profiler's HTTP Client panel, and you can override any option the usual way:
# config/packages/framework.yaml framework: http_client: scoped_clients: apaleo.http_client: scope: '.*' timeout: 30
Development
This package has its own tooling, mirroring apaleo-php:
task lint # PHPStan (max level), PHP CS Fixer, Rector, composer validate task test # PHPUnit task fix # auto-fix CS Fixer / Rector issues