Download the PHP package flytachi/winter-cast without Composer

On this page you can find all versions of the php package flytachi/winter-cast. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package winter-cast

Winter Cast Component

Latest Version on Packagist

A modern, fluent HTTP client for PHP 8.3+ with a focus on developer experience, type safety, and ease of use.

Features

โœจ Fluent API - Chainable, immutable request builder
๐ŸŽฏ Type-Safe - Full PHP 8.3+ type declarations
๐Ÿš€ Zero Config - Works out of the box with sensible defaults
๐Ÿ”„ Auto-Retry - Exponential backoff with jitter
โšก Fast - Powered by cURL for maximum performance
๐Ÿ›ก๏ธ Secure - URL validation, response size limits, timeout controls
๐Ÿ”Œ Middleware - Intercept requests/responses (logging, auth, retry)
๐Ÿ—๏ธ ApiService - Abstract base class for building API clients
๐Ÿ“ PSR-3 Logging - Built-in LoggingMiddleware
๐Ÿ’ฅ Smart Exceptions - Specific exception types for different errors


Installation

Requirements:


Quick Start

Simple GET Request

POST with JSON


Core Concepts

1. Cast Facade (Simple Usage)

The Cast facade provides a zero-configuration entry point:

Available methods:

2. CastRequest (Request Builder)

Build requests with a fluent interface:

3. CastHeader (Header Builder)

Fluent interface for headers:

Built-in helpers:

4. CastResponse (Response Object)

Immutable response with helper methods:


Advanced Usage

Query Parameters

Request Body

Timeouts & Retries

Exponential Backoff with Jitter:

Jitter prevents thundering herd problem when multiple clients retry simultaneously.

Error Handling

Exception hierarchy:

Dependency Injection

Custom Client Configuration


Middleware

Middleware allows you to intercept and modify requests/responses. Use cases include logging, authentication, caching, and retry logic.

Creating Custom Middleware

Adding Middleware to Client

Using with Facade


Built-in Middleware

Ready-to-use middleware classes in Flytachi\Winter\Cast\Stereotype:

LoggingMiddleware

Logs all HTTP requests and responses with PSR-3 logger:

BearerAuthMiddleware

Automatically adds Bearer token to all requests:

BasicAuthMiddleware

Adds HTTP Basic authentication:

HeadersMiddleware

Adds custom headers to all requests:

RetryOnUnauthorizedMiddleware

Automatically refreshes token on 401 and retries:


ApiService (Abstract Base Class)

Build clean API clients by extending ApiService. Each service has its own isolated CastClient.

Basic Usage

With Custom Client & Middleware

Available Methods

Method Description
get(string $path) Create GET request
post(string $path) Create POST request
put(string $path) Create PUT request
patch(string $path) Create PATCH request
delete(string $path) Create DELETE request
head(string $path) Create HEAD request
client() Get service's CastClient
setClient(CastClient) Replace service's client
tryResult(CastResponse) Extract data or throw exception

Security Features

URL Validation

Automatically validates URLs and rejects dangerous protocols:

Response Size Limit

Prevent memory exhaustion with automatic size limits:


Testing


Examples

GitHub API

Authenticated API Request

File Download

Pagination


License

The MIT License (MIT). Please see License File for more information.


Credits


All versions of winter-cast with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
flytachi/winter-base Version ^1.0 | ^3.0
ext-curl Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package flytachi/winter-cast contains the following files

Loading the files please wait ...