PHPackages                             codeat3/foaas-client - 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. [API Development](/categories/api)
4. /
5. codeat3/foaas-client

ActiveLibrary[API Development](/categories/api)

codeat3/foaas-client
====================

A PHP client for FOAAS service

1.0.2(6y ago)24MITPHPPHP ^7.1CI failing

Since Jul 17Pushed 6y ago1 watchersCompare

[ Source](https://github.com/codeat3/foaas-client)[ Packagist](https://packagist.org/packages/codeat3/foaas-client)[ Docs](https://github.com/codeat3/foaas-client)[ RSS](/packages/codeat3-foaas-client/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)Dependencies (4)Versions (4)Used By (0)

Very short description of the package
=====================================

[](#very-short-description-of-the-package)

[![Latest Version on Packagist](https://camo.githubusercontent.com/7027d6649555d8f726b08badc03fa91b9479a9c4caa9fd3a0e536d67a545af92/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f64656174332f666f6161732d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/codeat3/foaas-client)[![Build Status](https://camo.githubusercontent.com/69739e05d4c995ef7d84775e84769ed3d01692b859afdb7aecb7164c6a0e7dc2/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f636f64656174332f666f6161732d636c69656e742f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/codeat3/foaas-client)[![Quality Score](https://camo.githubusercontent.com/45a88b29bc7675724e96e16e99f596f762a872566a73de9b3f88bbc9bfce80e8/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f636f64656174332f666f6161732d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/codeat3/foaas-client)[![Total Downloads](https://camo.githubusercontent.com/ea3386ad5f083c5687e1b68afa7535100ec8eb344347f69b815da4a698393f7d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f64656174332f666f6161732d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/codeat3/foaas-client)

A PHP Client of [FOAAS](https://foaas.com/)

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

[](#installation)

You can install the package via composer:

```
composer require codeat3/foaas-client
```

Usage
-----

[](#usage)

Basic usage of the client

```
use Codeat3\FoaasClient\FoaasClient;

$foaasClient = new FoaasClient([
    'decency' => 'low', // possible decency filter options are 'low', 'medium', 'high', 'extreme' - default is no filter
]);
echo $foaasClient->what('John')->get();

// Output
What the f*ck‽ - John
```

Using format to get the response as per your need

```
use Codeat3\FoaasClient\FoaasClient;

$foaasClient = new FoaasClient([
    'decency' => 'low',
    'responseAs' => 'array', // possible response formats are 'text' (default), 'html', 'xml', 'json', 'array'
]);
print_r($foaasClient->what('John')->get());

// Output
Array
(
    [message] => What the f*ck‽
    [subtitle] => - John
)
```

Also few helpers are provided for the type of output expected

```
$foaasClient = new FoaasClient([
	'decency' => 'low',
]);
echo $foaasClient->what('John')->getAsText(); // What the f*ck‽ - John
echo $foaasClient->what('John')->getAsXml(); //   What the f*ck‽ - John
echo $foaasClient->what('John')->getAsHtml(); //    FOAAS - What the f*ck‽ - John   ...
echo $foaasClient->what('John')->getAsJson(); // {"message":"What the f*ck‽","subtitle":"- John"}

print_r($foaasClient->what('John')->getAsArray());
/*
Array
(
    [message] => What the f*ck‽
    [subtitle] => - John
)
*/
```

##### Custom Responses

[](#custom-responses)

You can implement the custom responses and pass it in customer as per your need

```
// Implementation
class ObjectResponse implements FoaasResponse
{
    protected $acceptHeader = 'application/json';

    public function getHeaders():string
    {
        return $this->acceptHeader;
    }

    public function response(string $response, FoaasFilter $filter)
    {
        $response = $filter->filter($response);
        return json_decode($response);
    }
}

// Use
$foaasClient = new FoaasClient([
    'decency' => 'low',
    'responseAs' => 'object',
    'responseFormats' => [
        'object' => ObjectResponse::class,
    ]
]);
var_dump($foaasClient->what('John')->get());

/*
class stdClass#27 (2) {
  public $message =>
  string(16) "What the f*ck‽"
  public $subtitle =>
  string(6) "- John"
}
*/
```

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Swapnil Sarwe](https://github.com/codeat3)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

PHP Package Boilerplate
-----------------------

[](#php-package-boilerplate)

This package was generated using the [PHP Package Boilerplate](https://laravelpackageboilerplate.com).

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

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 ~99 days

Total

3

Last Release

2296d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/166912?v=4)[Swapnil Sarwe](/maintainers/swapnilsarwe)[@swapnilsarwe](https://github.com/swapnilsarwe)

---

Top Contributors

[![swapnilsarwe](https://avatars.githubusercontent.com/u/166912?v=4)](https://github.com/swapnilsarwe "swapnilsarwe (12 commits)")

---

Tags

clientfoaasphpcodeat3foaas-client

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/codeat3-foaas-client/health.svg)

```
[![Health](https://phpackages.com/badges/codeat3-foaas-client/health.svg)](https://phpackages.com/packages/codeat3-foaas-client)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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