niladam / salette
🚀Easily build API integrations into your legacy application.
Requires
- php: >=7.4 < 8.0
- ext-json: *
- guzzlehttp/guzzle: ^7.9
Requires (Dev)
- ext-xml: *
- ergebnis/composer-normalize: ^2.47
- friendsofphp/php-cs-fixer: ^3.75
- illuminate/collections: ^8.83
- league/flysystem: ^2.5
- pestphp/pest: ^1.23
- pestphp/pest-plugin-parallel: ^1.2
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^9
- squizlabs/php_codesniffer: ^3.12
- symfony/dom-crawler: ^5.4
- symfony/var-dumper: ^4.3.4 || ^5.0 || ^6.0 || ^7.0
Suggests
- ext-xml: Used if you plan on using the xml handing
- illuminate/collections: Required for the response collect() method.
- illuminate/support: Required for Laravel integration (auto-discovery of ServiceProvider)
This package is auto-updated.
Last update: 2025-07-23 20:53:16 UTC
README
Salette
The power of Saloon - for PHP 7.4
Salette is a port of the Saloon PHP package, tailored specifically for legacy applications that require PHP 7.4 compatibility.
This package exists with permission from the original author Sam Carré and aims to mirror and ensure the functionality and developer experience of Saloon as closely as possible within the limitations of PHP 7.4.
Tip
If your application uses PHP 8.0 or higher, you should use the official Saloon package instead.
What is Salette?
Salette helps you build clean, reusable API integrations and SDKs in PHP 7.4, in the same way you would do using Saloon.
It organizes your requests into structured classes, centralizing your API logic and making your codebase more maintainable.
Key Features
- 🚀 PHP 7.4 Compatible - Built specifically for legacy applications
- 🔧 Simple & Modern - Easy-to-learn, clean API for building integrations
- 🏗️ Built on Guzzle - Leverages the most popular and feature-rich HTTP client
- 🧪 Built-in Testing - Mock responses, request recording, and test your integrations easily
- 🔐 Authentication - Support for OAuth2, Basic Auth, Token Auth, and more
- 📦 Request/Response Handling - Built-in support for JSON, XML, Form data, and more
- 🔄 Advanced Features - Request concurrency, caching (soon), Dto support
- 🎯 Team-Friendly - Provides a standard everyone can follow
- 🏢 Framework Agnostic - Vanilla PHP or any PHP framework that supports composer :)
- 📚 Laravel Support - Full Laravel integration and support (soon)
- ⚡ Lightweight - Few dependencies, fast performance
Quick Start
1. Install the package
composer require niladam/salette
2. Generate a Working Example
The fastest way to get started is to generate a ready-to-use integration:
php vendor/niladam/salette/examples/create-integration.php
Or, in code:
use Salette\Helpers\Stub; Stub::create(); // Instantly creates a JsonPlaceholder integration you can use and modify
This will create:
app/Http/Integrations/JsonPlaceholder/JsonPlaceholderConnector.php
app/Http/Integrations/JsonPlaceholder/Requests/GetPostsRequest.php
app/Http/Integrations/JsonPlaceholder/Requests/CreatePostRequest.php
You can use these classes right away, and just change the URL, endpoints, or request bodies to match your API.
3. Using Your Integration
use App\Http\Integrations\JsonPlaceholder\JsonPlaceholderConnector; use App\Http\Integrations\JsonPlaceholder\Requests\GetPostsRequest; use App\Http\Integrations\JsonPlaceholder\Requests\CreatePostRequest; $connector = new JsonPlaceholderConnector(); // GET /posts $response = $connector->send(new GetPostsRequest()); $data = $response->json(); // POST /posts $response = $connector->send(new CreatePostRequest()); $data = $response->json();
For advanced usage, options, and customization, see: