{"id":22173455,"url":"https://github.com/codeat3/foaas-client","last_synced_at":"2025-03-24T17:46:18.236Z","repository":{"id":56954871,"uuid":"196581116","full_name":"codeat3/foaas-client","owner":"codeat3","description":"A PHP Client for FOAAS Service","archived":false,"fork":false,"pushed_at":"2020-01-31T12:13:15.000Z","size":59,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-29T22:33:12.474Z","etag":null,"topics":["client","foaas","php"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codeat3.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-12T13:07:45.000Z","updated_at":"2020-01-31T12:12:18.000Z","dependencies_parsed_at":"2022-08-21T08:50:18.916Z","dependency_job_id":null,"html_url":"https://github.com/codeat3/foaas-client","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeat3%2Ffoaas-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeat3%2Ffoaas-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeat3%2Ffoaas-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeat3%2Ffoaas-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codeat3","download_url":"https://codeload.github.com/codeat3/foaas-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245320699,"owners_count":20596236,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["client","foaas","php"],"created_at":"2024-12-02T07:33:30.004Z","updated_at":"2025-03-24T17:46:18.195Z","avatar_url":"https://github.com/codeat3.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Very short description of the package\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/codeat3/foaas-client.svg?style=flat-square)](https://packagist.org/packages/codeat3/foaas-client)\n[![Build Status](https://img.shields.io/travis/codeat3/foaas-client/master.svg?style=flat-square)](https://travis-ci.org/codeat3/foaas-client)\n[![Quality Score](https://img.shields.io/scrutinizer/g/codeat3/foaas-client.svg?style=flat-square)](https://scrutinizer-ci.com/g/codeat3/foaas-client)\n[![Total Downloads](https://img.shields.io/packagist/dt/codeat3/foaas-client.svg?style=flat-square)](https://packagist.org/packages/codeat3/foaas-client)\n\nA PHP Client of [FOAAS](https://foaas.com/)\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require codeat3/foaas-client\n```\n\n## Usage\nBasic usage of the client\n\n``` php\nuse Codeat3\\FoaasClient\\FoaasClient;\n\n$foaasClient = new FoaasClient([\n    'decency' =\u003e 'low', // possible decency filter options are 'low', 'medium', 'high', 'extreme' - default is no filter\n]);\necho $foaasClient-\u003ewhat('John')-\u003eget();\n\n// Output\nWhat the f*ck‽ - John\n```\n\nUsing format to get the response as per your need\n```php\nuse Codeat3\\FoaasClient\\FoaasClient;\n\n$foaasClient = new FoaasClient([\n    'decency' =\u003e 'low',\n    'responseAs' =\u003e 'array', // possible response formats are 'text' (default), 'html', 'xml', 'json', 'array'\n]);\nprint_r($foaasClient-\u003ewhat('John')-\u003eget());\n\n// Output\nArray\n(\n    [message] =\u003e What the f*ck‽\n    [subtitle] =\u003e - John\n)\n```\n\nAlso few helpers are provided for the type of output expected\n```php\n$foaasClient = new FoaasClient([\n\t'decency' =\u003e 'low',\n]);\necho $foaasClient-\u003ewhat('John')-\u003egetAsText(); // What the f*ck‽ - John\necho $foaasClient-\u003ewhat('John')-\u003egetAsXml(); // \u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e \u003cfoaas:response xmlns:foaas=\"http://foaas.com/f*ckoff\"\u003e \u003cfoaas:message\u003eWhat the f*ck‽\u003c/foaas:message\u003e \u003cfoaas:subtitle\u003e- John\u003c/foaas:subtitle\u003e \u003c/foaas:response\u003e\necho $foaasClient-\u003ewhat('John')-\u003egetAsHtml(); // \u003c!DOCTYPE html\u003e \u003chtml\u003e \u003chead\u003e \u003ctitle\u003eFOAAS - What the f*ck‽ - John\u003c/title\u003e \u003cmeta charset=\"utf-8\"\u003e \u003cmeta property=\"og:title\" content=\"What the f*ck‽ - John\"\u003e ...\necho $foaasClient-\u003ewhat('John')-\u003egetAsJson(); // {\"message\":\"What the f*ck‽\",\"subtitle\":\"- John\"}\n\nprint_r($foaasClient-\u003ewhat('John')-\u003egetAsArray());\n/*\nArray\n(\n    [message] =\u003e What the f*ck‽\n    [subtitle] =\u003e - John\n)\n*/\n```\n\n##### Custom Responses\nYou can implement the custom responses and pass it in customer as per your need\n```php\n// Implementation\nclass ObjectResponse implements FoaasResponse\n{\n    protected $acceptHeader = 'application/json';\n\n    public function getHeaders():string\n    {\n        return $this-\u003eacceptHeader;\n    }\n\n    public function response(string $response, FoaasFilter $filter)\n    {\n        $response = $filter-\u003efilter($response);\n        return json_decode($response);\n    }\n}\n\n// Use\n$foaasClient = new FoaasClient([\n    'decency' =\u003e 'low',\n    'responseAs' =\u003e 'object',\n    'responseFormats' =\u003e [\n        'object' =\u003e ObjectResponse::class,\n    ]\n]);\nvar_dump($foaasClient-\u003ewhat('John')-\u003eget());\n\n/*\nclass stdClass#27 (2) {\n  public $message =\u003e\n  string(16) \"What the f*ck‽\"\n  public $subtitle =\u003e\n  string(6) \"- John\"\n}\n*/\n```\n### Testing\n\n``` bash\ncomposer test\n```\n\n### Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n### Security\n\nIf you discover any security related issues, please email swapnilsarwe@gmail.com instead of using the issue tracker.\n\n## Credits\n\n- [Swapnil Sarwe](https://github.com/codeat3)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n## PHP Package Boilerplate\n\nThis package was generated using the [PHP Package Boilerplate](https://laravelpackageboilerplate.com).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeat3%2Ffoaas-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodeat3%2Ffoaas-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeat3%2Ffoaas-client/lists"}