🦖
[] Өөрчлөлтийн түүх
codesaur/http-client GitHub дээр үзэх

Changelog

This file contains all changes for all versions of the codesaur/http-client package.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.


[2.1.2] - 2026-07-03

[2.1.2]: https://github.com/codesaur-php/HTTP-Client/compare/v2.1.1...v2.1.2

Fixed

  • CurlClient::send():
    • Response headers are now reset on each new status line, so when redirects are followed (CURLOPT_FOLLOWLOCATION) only the final response's headers are returned instead of a mix of all responses' headers
    • A request body of '0' is no longer silently dropped (!empty() check replaced with explicit ''/[] comparison)
  • Mail:
    • Folded Cc:/Bcc: header lines now use CRLF (\r\n\t) as required by RFC 5322, instead of a bare LF
    • addUrlAttachment() now validates the status code itself, so it works with HTTP/2 servers (whose status line is HTTP/2 200 without the OK reason phrase) and with URLs that redirect before resolving to 200
    • MIME boundary is now generated with uniqid() + mt_rand() instead of md5(time()), so two mails sent within the same second no longer share the same boundary
  • phpunit.xml: test suites renamed Unit Tests/Integration Tests -> Unit/Integration to match composer scripts - previously composer test:unit and composer test:integration executed no tests at all
  • phpunit.xml: removed deprecated beStrictAboutTodoAnnotatedTests attribute (PHPUnit 10.5 deprecation warning)

Changed

  • CI workflow: GitHub Actions updated for Node.js 24 runtime (actions/checkout@v5, actions/cache@v5, codecov/codecov-action@v6) - resolves the Node.js 20 deprecation warning

[2.1.1] - 2026-06-09

[2.1.1]: https://github.com/codesaur-php/HTTP-Client/compare/v2.1.0...v2.1.1

Changed

  • Private property names no longer use a leading underscore (PSR-12 compliance)
    • Mail: $_recipients -> $recipients, $_attachments -> $attachments
    • Internal only - all properties are private, so the public API is unchanged.

[2.1.0] - 2026-03-21

[2.1.0]: https://github.com/codesaur-php/HTTP-Client/compare/v2.0.4...v2.1.0

Added

  • Response class (src/Response.php):
    • New class to represent HTTP responses as objects
    • statusCode, headers, body readonly properties
    • json() - decode response body as JSON array
    • isOk() - check if status code is 2xx
    • isError() - check if status code is 4xx/5xx
    • getHeader() - case-insensitive header lookup
  • CurlClient new methods:
    • send() - same as request() but returns a Response object (status code, headers, body)
    • sendWithRetry() - automatically retry failed requests with exponential backoff (retries 5xx server errors, does not retry 4xx client errors)
    • upload() - file upload via CURLFile as multipart/form-data, with additional form field support
    • enableDebug() / getDebugLog() / clearDebugLog() - enable debug mode to log detailed request/response information
  • JSONClient new methods:
    • patch() - send JSON PATCH request (partial update)
    • __construct($baseUrl) - set base URL, automatically prepended to all request URIs
    • getBaseUrl() - get the current base URL
    • Full URLs (http/https) automatically bypass the base URL
  • New tests:
    • ResponseTest.php - 11 tests (constructor, json, isOk, isError, getHeader, readonly)
    • CurlClientTest.php - 15 new tests added (send, debug, retry, upload)
    • JSONClientTest.php - 7 new tests added (patch, baseUrl)

Changed

  • CurlClient::request() now internally delegates to send() (public API unchanged, backward compatible)
  • CurlClient::send() accepts string|array data (array for file upload support)

[2.0.4] - 2026-03-05

[2.0.4]: https://github.com/codesaur-php/HTTP-Client/compare/v2.0.3...v2.0.4

Fixed

  • Stripped trailing whitespace from all source and documentation files
  • Removed double-space artifacts left behind after emoji removal

Changed

  • Removed personal phone number from composer.json authors field

[2.0.3] - 2026-03-04

[2.0.3]: https://github.com/codesaur-php/HTTP-Client/compare/v2.0.2...v2.0.3

Changed

  • Removed all emoji characters from documentation and source files (README, docs, PHPDoc comments)
  • Fixed Mongolian text capitalization errors (e.g., Нийт Тестийн Статистик -> Нийт тестийн статистик)

[2.0.2] - 2026-01-20

[2.0.2]: https://github.com/codesaur-php/HTTP-Client/compare/v2.0.1...v2.0.2

Added

  • JSONClient cURL options дэмжлэг:
    • get(), post(), put(), delete() методууд бүгд $options параметр авдаг болсон
    • request() метод нэмэлт cURL options хүлээн авах боломжтой болсон
    • Жишээ: CURLOPT_HTTP_VERSION, CURLOPT_TIMEOUT, CURLOPT_CONNECTTIMEOUT гэх мэт тохиргоонуудыг дамжуулах боломжтой
    • Хэрэглэгчийн өгсөн options нь default options-ийг давамгайлна (array_replace ашигласан)

Changed

  • JSONClient методуудын PHPDoc баримтжуулалт шинэчлэгдсэн

[2.0.1] - 2026-01-08

[2.0.1]: https://github.com/codesaur-php/HTTP-Client/compare/v2.0.0...v2.0.1

Changed

  • Refactored main README.md to properly reflect HTTP-Client project structure and features
  • Simplified test section in docs/mn/README.md with clearer composer command documentation

Added

  • Complete English translation of all documentation files in docs/en/:
    • docs/en/README.md - Full English documentation
    • docs/en/api.md - Complete API documentation in English
    • docs/en/review.md - Package review and code quality assessment in English
  • Bilingual code comments (Mongolian/English) in README.md examples

Documentation

  • Improved documentation structure and consistency across all language versions
  • Added comprehensive test command documentation with examples
  • Enhanced code examples with bilingual comments for better understanding

[2.0.0] - 2025-12-18

[2.0.0]: https://github.com/codesaur-php/HTTP-Client/compare/v1.0...v2.0.0

Breaking Changes

  • PHP Version Requirement: Minimum PHP version increased from >=7.2.0 to ^8.2.1
  • Client class renamed: Client class renamed to CurlClient for better clarity
  • JSONClient architecture: Changed from inheritance (extends Client) to composition (uses CurlClient internally)
  • Mail class API: Complete rewrite with fluent interface pattern
    • send() method replaced with sendMail()
    • sendSMTP() method removed (PHPMailer dependency removed)
    • New fluent methods: targetTo(), addRecipient(), addCCRecipient(), addBCCRecipient(), setFrom(), setSubject(), setMessage(), etc.

Added

  • CurlClient improvements:
    • Comprehensive PHPDoc documentation in Mongolian
    • Default parameter values for request() method ($method = 'GET', $data = '', $options = [])
    • Return type hints (: string)
    • Improved HTTP header array initialization handling
  • JSONClient enhancements:
    • New put() method for PUT requests
    • New delete() method for DELETE requests
    • Smart GET request handling: payload automatically converted to query string
    • Environment-based SSL verification: respects CODESAUR_APP_ENV variable
      • development environment: SSL verify disabled
      • production or other: SSL verify enabled
    • Improved JSON decode error handling with proper validation
    • Comprehensive PHPDoc documentation
  • Mail class features:
    • Fluent interface for method chaining
    • Multiple recipients support (To, Cc, Bcc)
    • Multiple attachment support:
      • File path attachments via addFileAttachment()
      • URL attachments via addUrlAttachment()
      • Raw content attachments via addContentAttachment()
    • MIME multipart email generation for attachments
    • Enhanced UTF-8 encoding support for headers and filenames
    • Email validation for all addresses
    • Comprehensive PHPDoc documentation
  • Testing infrastructure:
    • Complete PHPUnit test suite
    • Unit tests for all classes
    • Integration tests for real-world scenarios
    • End-to-end tests
    • Test scripts in composer.json (test, test:unit, test:integration, test:coverage, test:all)
  • CI/CD pipeline:
    • GitHub Actions workflow for automated testing
    • Multi-PHP version testing (8.2, 8.3)
    • Multi-OS testing (Ubuntu, Windows)
    • Code coverage reporting
    • Security audit via Composer
  • Documentation:
    • Comprehensive README.md with examples
    • API.md documentation (auto-generated from PHPDoc)
    • REVIEW.md code quality assessment
    • Improved code examples and usage instructions

Changed

  • Code quality improvements:
    • Modern PHP array syntax ([] instead of array())
    • Proper namespace prefixing for global functions (\curl_init() instead of curl_init())
    • Type hints added throughout codebase
    • Return type declarations added
    • Better error handling and validation
  • Composer configuration:
    • Removed phpmailer/phpmailer dependency (Mail class now uses native PHP mail() function)
    • Added phpunit/phpunit as dev dependency
    • Added autoload-dev section for test classes
    • Added test scripts for easier testing
    • Updated package description and keywords
    • Updated author information and homepage URLs

Removed

  • PHPMailer dependency (SMTP functionality removed from Mail class)
  • sendSMTP() method from Mail class

Fixed

  • Improved error handling in CurlClient for edge cases
  • Better JSON decode validation in JSONClient
  • Fixed HTTP header array handling in CurlClient
  • Enhanced email address validation in Mail class

[1.0] - 2021-10-10

[1.0]: https://github.com/codesaur-php/HTTP-Client/releases/tag/v1.0

Added

  • Client class - Basic cURL-based HTTP client
    • request() method for sending HTTP requests with custom methods
    • Support for GET, POST, PUT, DELETE and other HTTP methods
    • Custom cURL options configuration
    • Basic error handling with Exception throwing
  • JSONClient class - JSON API client extending Client
    • get() method for GET requests with JSON payload
    • post() method for POST requests with JSON payload
    • Automatic JSON encoding/decoding
    • SSL verification disabled by default
    • Error handling returns error array structure instead of throwing exceptions
  • Mail class - Email sending functionality
    • send() method for basic email sending using PHP's native mail() function
      • Support for UTF-8 encoded subject and content
      • Automatic content-type detection (text/plain or text/html)
      • Base64 encoding for message content
      • Support for array-based sender and recipient with name encoding
    • sendSMTP() method for SMTP email sending using PHPMailer
      • Full SMTP configuration support (host, port, username, password)
      • SMTP authentication support
      • SSL/TLS secure connection support
      • Custom SMTP options configuration
      • HTML message support via MsgHTML()
  • Composer package configuration
    • PHP 7.2+ requirement
    • Required extensions: ext-curl, ext-json
    • PHPMailer dependency (phpmailer/phpmailer >= 6.5)
    • PSR-4 autoloading support
  • Basic example files
    • Example usage for HTTP client
    • Example usage for Mail functionality

Features

  • Object-oriented HTTP client implementation
  • JSON-based API communication support
  • Dual email sending methods (native PHP mail and SMTP via PHPMailer)
  • UTF-8 support for international characters
  • Simple and lightweight design
  • Framework-agnostic (can be used standalone or with any PHP framework)