niladam/salette

🚀Easily build API integrations into your legacy application.

1.0.2 2025-07-23 16:57 UTC

README

A legacy focus backport of Saloon

Salette

The power of Saloon - for PHP 7.4

Downloads Tests PHP 7.4 License

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:

Credits