PHPackages                             sharkmachine/psr18-shark - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. sharkmachine/psr18-shark

ActiveProject[HTTP &amp; Networking](/categories/http)

sharkmachine/psr18-shark
========================

A simple cURL PSR-18 client

1.1.1(3mo ago)0192MITPHPPHP &gt;=8.2CI passing

Since Oct 8Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/SharkMachine/psr18-shark)[ Packagist](https://packagist.org/packages/sharkmachine/psr18-shark)[ RSS](/packages/sharkmachine-psr18-shark/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (9)Versions (10)Used By (0)

PSR-18 Shark
============

[](#psr-18-shark)

A simple PSR-18 curl client for PHP. You need PSR-7 and PSR-17 libraries to use this client, for example `nyholm/psr7`.

The following design choices have been made:

- The client doesn't follow redirects. You need to either handle it in the code yourself or use `RedirectTransferHandler`.
- The client doesn't throw any exceptions unless there is a curl error. If you need handling for HTTP 4xx or 5xx status codes, you either need to implement it yourself or use `ThrowOnErrorTransferHandler`.

Installation
------------

[](#installation)

```
composer require sharkmachine/psr18-shark
```

Supported PHP versions
----------------------

[](#supported-php-versions)

Library versionPHP 8.2PHP 8.3PHP 8.4PHP 8.52.0 (next, not released)x✓✓✓1.x (current version)✓✓✓✓Request mutation
----------------

[](#request-mutation)

If you need to change the request before it is sent without relying on PSR-18 functionality, you can create mutation handlers for it. `$requestMutationHandlerCollection` constructor parameter is used to pass a collection of handlers to the client.

Response mutation
-----------------

[](#response-mutation)

If you need to change the response before it is returned without relying on PSR-18 functionality, you can create mutation handlers for it. `$responseMutationHandlerCollection` constructor parameter is used to pass a collection of handlers to the client.

Transfer handlers
-----------------

[](#transfer-handlers)

Transfer handlers can be used to handle exceptions thrown in the case of curl errors or to handle re-sending the request in certain situations. `$transferHandlerCollection` constructor parameter is used to pass a collection of handlers to the client.

Please note that if a response cannot be received and the handler doesn't throw an exception in this case, `NoResponseException` is thrown.

The following transfer handlers are included in the library:

- `RedirectTransferHandler` - Handler that will follow redirects.
- `ThrowOnErrorTransferHandler` - Handler that will throw an exception if the response status code is 4xx or 5xx.

Custom curl options
-------------------

[](#custom-curl-options)

You can pass custom curl options to the client with `$curlOptions` constructor parameter. Please note that the following options are ignored:

- `CURLOPT_FOLLOWLOCATION` - Redirects are not followed, please use `RedirectTransferHandler` or handle the redirects yourself.
- `CURLOPT_HEADER` - Headers are set in the request.
- `CURLOPT_WRITEFUNCTION` - The client uses this to get the response body.
- `CURLOPT_HEADERFUNCTION` - The client uses this to get the response headers.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance79

Regular maintenance activity

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~79 days

Recently: every ~107 days

Total

7

Last Release

112d ago

Major Versions

1.1.0 → 2.0.x-dev2025-08-23

PHP version history (2 changes)1.0.0-beta1PHP &gt;=8.3

1.1.0PHP &gt;=8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/1d61a64a7be7a4545897e100ca85c962c7ee6d5652bdc632887836627e297317?d=identicon)[SharkMachine](/maintainers/SharkMachine)

---

Top Contributors

[![SharkMachine](https://avatars.githubusercontent.com/u/7488694?v=4)](https://github.com/SharkMachine "SharkMachine (29 commits)")

###  Code Quality

TestsPHPUnit

Type Coverage Yes

### Embed Badge

![Health badge](/badges/sharkmachine-psr18-shark/health.svg)

```
[![Health](https://phpackages.com/badges/sharkmachine-psr18-shark/health.svg)](https://phpackages.com/packages/sharkmachine-psr18-shark)
```

###  Alternatives

[laudis/neo4j-php-client

Neo4j-PHP-Client is the most advanced PHP Client for Neo4j

184616.9k31](/packages/laudis-neo4j-php-client)[shopify/shopify-api

Shopify API Library for PHP

4634.8M16](/packages/shopify-shopify-api)[spiral/roadrunner-http

RoadRunner: HTTP and PSR-7 worker

779.2M48](/packages/spiral-roadrunner-http)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28137.8k](/packages/phpro-http-tools)[mezzio/mezzio-authentication-oauth2

OAuth2 (server) authentication middleware for Mezzio and PSR-7 applications.

28483.0k2](/packages/mezzio-mezzio-authentication-oauth2)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
