niladam/salette
Composer 安装命令:
composer require niladam/salette
包简介
🚀Easily build API integrations into your legacy application.
README 文档
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.phpapp/Http/Integrations/JsonPlaceholder/Requests/GetPostsRequest.phpapp/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
niladam/salette 适用场景与选型建议
niladam/salette 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 72 次下载、GitHub Stars 达 11, 最近一次更新时间为 2025 年 07 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 niladam/salette 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 niladam/salette 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 72
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 11
- 点击次数: 10
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-07-21
