snapflowio/requests 问题修复 & 功能扩展

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

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

snapflowio/requests

最新稳定版本:v0.1.0

Composer 安装命令:

composer require snapflowio/requests

包简介

A simple and lightweight library for crafting HTTP requests.

README 文档

README

A simple and lightweight library for crafting HTTP requests.

Installation

composer require snapflow/requests

Quick Start

<?php

require_once __DIR__ . '/vendor/autoload.php';

use Snapflow\Requests\Client;
use Snapflow\Requests\HttpMethod;
use Snapflow\Requests\ContentType;

// Simple GET request
$client = new Client();
$response = $client->fetch('https://api.example.com/users/1');
echo $response->text();

// GET with JSON parsing
$data = $response->json();
echo $data['name'];

// POST with JSON body
$client = new Client();
$client->addHeader('Content-Type', ContentType::APPLICATION_JSON->value);

$response = $client->fetch(
    url: 'https://api.example.com/users',
    method: HttpMethod::POST->value,
    body: [
        'name' => 'John Doe',
        'email' => 'john@example.com'
    ]
);

// GET with query parameters
$response = $client->fetch(
    url: 'https://api.example.com/users',
    query: ['page' => 1, 'limit' => 10]
);

// Configure retries and timeouts
$client->setMaxRetries(3)
       ->setRetryDelay(1000)
       ->setTimeout(30000);

License

This library is available under the MIT License.

Copyright

Copyright (c) 2025 Snapflow

统计信息

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

GitHub 信息

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

其他信息

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