niladam/salette 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

niladam/salette

最新稳定版本:1.0.2

Composer 安装命令:

composer require niladam/salette

包简介

🚀Easily build API integrations into your legacy application.

README 文档

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

统计信息

  • 总下载量: 65
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 11
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 11
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-21