Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@ permissions:
contents: read

on:
schedule:
- cron: '0 4 * * *' # daily 04:00 UTC canary keepalive
pull_request:
branches:
- "*"
push:
branches:
- 'master'
workflow_dispatch: {}

env:
COLUMNS: 120
Expand All @@ -34,12 +37,12 @@ jobs:
JBZOO_COMPOSER_UPDATE_FLAGS: ${{ matrix.composer_flags }}
strategy:
matrix:
php-version: [ 8.2, 8.3, 8.4 ]
php-version: [ 8.3, 8.4, 8.5 ]
coverage: [ xdebug, none ]
composer_flags: [ "--prefer-lowest", "" ]
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v7
with:
fetch-depth: 0

Expand All @@ -61,29 +64,30 @@ jobs:
run: make test --no-print-directory

- name: Uploading coverage to coveralls
if: ${{ matrix.coverage == 'xdebug' }}
if: '${{ matrix.coverage == ''xdebug'' }}'
continue-on-error: true
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: make report-coveralls --no-print-directory || true

- name: Upload Artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
continue-on-error: true
with:
name: PHPUnit - ${{ matrix.php-version }} - ${{ matrix.coverage }}
path: build/
overwrite: true


linters:
name: Linters
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [ 8.2, 8.3, 8.4 ]
php-version: [ 8.3, 8.4, 8.5 ]
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v7
with:
fetch-depth: 0

Expand All @@ -102,22 +106,23 @@ jobs:
run: make codestyle --no-print-directory

- name: Upload Artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
continue-on-error: true
with:
name: Linters - ${{ matrix.php-version }}
path: build/
overwrite: true


report:
name: Reports
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [ 8.2, 8.3, 8.4 ]
php-version: [ 8.3, 8.4, 8.5 ]
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v7
with:
fetch-depth: 0

Expand All @@ -136,8 +141,9 @@ jobs:
run: make report-all --no-print-directory

- name: Upload Artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
continue-on-error: true
with:
name: Reports - ${{ matrix.php-version }}
path: build/
overwrite: true
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ src/
```

## Dependencies
- **Required**: PHP 8.2+, jbzoo/data, jbzoo/utils, jbzoo/event
- **Required**: PHP 8.3+, jbzoo/data, jbzoo/utils, jbzoo/event
- **Suggested**: guzzlehttp/guzzle (recommended) or rmccue/requests (fallback)
- **Dev Dependencies**: jbzoo/toolbox-dev for code quality tools

Expand Down
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
# JBZoo / Http-Client

[![CI](https://github.com/JBZoo/Http-Client/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/JBZoo/Http-Client/actions/workflows/main.yml?query=branch%3Amaster) [![Coverage Status](https://coveralls.io/repos/github/JBZoo/Http-Client/badge.svg?branch=master)](https://coveralls.io/github/JBZoo/Http-Client?branch=master) [![Psalm Coverage](https://shepherd.dev/github/JBZoo/Http-Client/coverage.svg)](https://shepherd.dev/github/JBZoo/Http-Client) [![Psalm Level](https://shepherd.dev/github/JBZoo/Http-Client/level.svg)](https://shepherd.dev/github/JBZoo/Http-Client) [![CodeFactor](https://www.codefactor.io/repository/github/jbzoo/http-client/badge)](https://www.codefactor.io/repository/github/jbzoo/http-client/issues)
[![Stable Version](https://poser.pugx.org/jbzoo/http-client/version)](https://packagist.org/packages/jbzoo/http-client/) [![Total Downloads](https://poser.pugx.org/jbzoo/http-client/downloads)](https://packagist.org/packages/jbzoo/http-client/stats) [![Dependents](https://poser.pugx.org/jbzoo/http-client/dependents)](https://packagist.org/packages/jbzoo/http-client/dependents?order_by=downloads) [![GitHub License](https://img.shields.io/github/license/jbzoo/http-client)](https://github.com/JBZoo/Http-Client/blob/master/LICENSE)
[![CI](https://github.com/JBZoo/Http-Client/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/JBZoo/Http-Client/actions/workflows/main.yml?query=branch%3Amaster)
[![Coverage Status](https://coveralls.io/repos/github/JBZoo/Http-Client/badge.svg?branch=master)](https://coveralls.io/github/JBZoo/Http-Client?branch=master)
[![Psalm Coverage](https://shepherd.dev/github/JBZoo/Http-Client/coverage.svg)](https://shepherd.dev/github/JBZoo/Http-Client)
[![Psalm Level](https://shepherd.dev/github/JBZoo/Http-Client/level.svg)](https://shepherd.dev/github/JBZoo/Http-Client)
[![CodeFactor](https://www.codefactor.io/repository/github/jbzoo/http-client/badge)](https://www.codefactor.io/repository/github/jbzoo/http-client/issues)

[![Stable Version](https://poser.pugx.org/jbzoo/http-client/version)](https://packagist.org/packages/jbzoo/http-client/)
[![Total Downloads](https://poser.pugx.org/jbzoo/http-client/downloads)](https://packagist.org/packages/jbzoo/http-client/stats)
[![Dependents](https://poser.pugx.org/jbzoo/http-client/dependents)](https://packagist.org/packages/jbzoo/http-client/dependents?order_by=downloads)
[![GitHub License](https://img.shields.io/github/license/jbzoo/http-client)](https://github.com/JBZoo/Http-Client/blob/master/LICENSE)

A simple, intuitive PHP HTTP client that provides a clean wrapper around popular HTTP libraries like Guzzle and rmccue/requests. Make HTTP requests with minimal code and maximum flexibility.

Expand All @@ -13,12 +21,12 @@ A simple, intuitive PHP HTTP client that provides a clean wrapper around popular
- **Flexible Response Handling**: Access response data via methods, properties, or array syntax
- **JSON Support**: Built-in JSON parsing with JBZoo/Data integration
- **Event System**: Hook into request lifecycle with event listeners
- **PHP 8.2+ Ready**: Modern PHP with strict typing and best practices
- **PHP 8.3+ Ready**: Modern PHP with strict typing and best practices


## Requirements

- PHP 8.2 or higher
- PHP 8.3 or higher
- ext-json

## Installation
Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@
"prefer-stable" : true,

"require" : {
"php" : "^8.2",
"php" : "^8.3",
"ext-json" : "*",

"jbzoo/data" : "^7.2",
"jbzoo/utils" : "^7.3",
"jbzoo/event" : "^7.0.2"
"jbzoo/data" : "^8.0",
"jbzoo/utils" : "^8.0",
"jbzoo/event" : "^8.0"
},

"require-dev" : {
"jbzoo/toolbox-dev" : "^7.2",
"jbzoo/toolbox-dev" : "^8.0",
"rmccue/requests" : ">=2.0.15",
"guzzlehttp/guzzle" : ">=7.10.0"
},
Expand All @@ -62,7 +62,7 @@

"extra" : {
"branch-alias" : {
"dev-master" : "7.x-dev"
"dev-master" : "8.x-dev"
}
}
}
22 changes: 9 additions & 13 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,14 @@
@copyright Copyright (C) JBZoo.com, All rights reserved.
@see https://github.com/JBZoo/Http-Client
-->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="tests/autoload.php"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
convertDeprecationsToExceptions="true"
<phpunit bootstrap="tests/autoload.php"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
stopOnRisky="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
stopOnRisky="false">
<coverage>
<report>
<clover outputFile="build/coverage_xml/main.xml"/>
<php outputFile="build/coverage_cov/main.cov"/>
Expand All @@ -44,4 +34,10 @@
<logging>
<junit outputFile="build/coverage_junit/main.xml"/>
</logging>

<source>
<include>
<directory suffix=".php">src</directory>
</include>
</source>
</phpunit>
3 changes: 0 additions & 3 deletions src/HttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,6 @@ public function setEventManager(EventManager $eManager): self
return $this;
}

/**
* @psalm-suppress PossiblyUnusedReturnValue
*/
public function trigger(string $eventName, array $context = [], ?\Closure $callback = null): int
{
if ($this->eManager !== null) {
Expand Down
1 change: 0 additions & 1 deletion src/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ final class Response

/**
* @return null|array|float|int|string|string[]
* @psalm-suppress PossiblyUnusedReturnValue
*/
public function __get(string $name)
{
Expand Down
Loading