{"id":21988862,"url":"https://github.com/indragunawan/rest-service","last_synced_at":"2025-08-19T08:35:06.437Z","repository":{"id":56990987,"uuid":"65572289","full_name":"IndraGunawan/rest-service","owner":"IndraGunawan","description":"Provides an implementation of the Guzzle Command library.","archived":false,"fork":false,"pushed_at":"2017-12-14T09:30:23.000Z","size":50,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-06T02:22:21.294Z","etag":null,"topics":["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/IndraGunawan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-12T17:43:55.000Z","updated_at":"2018-01-18T07:54:55.000Z","dependencies_parsed_at":"2022-08-21T12:20:34.328Z","dependency_job_id":null,"html_url":"https://github.com/IndraGunawan/rest-service","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/IndraGunawan/rest-service","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IndraGunawan%2Frest-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IndraGunawan%2Frest-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IndraGunawan%2Frest-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IndraGunawan%2Frest-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IndraGunawan","download_url":"https://codeload.github.com/IndraGunawan/rest-service/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IndraGunawan%2Frest-service/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271122438,"owners_count":24703003,"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","status":"online","status_checked_at":"2025-08-19T02:00:09.176Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["php"],"created_at":"2024-11-29T19:23:04.542Z","updated_at":"2025-08-19T08:35:06.415Z","avatar_url":"https://github.com/IndraGunawan.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"RestService\n===========\n\n[![GitHub license](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](https://github.com/indragunawan/rest-service/blob/master/LICENSE)\n[![Travis](https://img.shields.io/travis/indragunawan/rest-service.svg?style=flat-square)](https://api.travis-ci.org/IndraGunawan/rest-service.svg?branch=master)\n[![Scrutinizer](https://img.shields.io/scrutinizer/g/indragunawan/rest-service.svg?style=flat-square)](https://scrutinizer-ci.com/g/indragunawan/rest-service)\n[![Scrutinizer Coverage](https://img.shields.io/scrutinizer/coverage/g/indragunawan/rest-service.svg?style=flat-square)](https://scrutinizer-ci.com/g/indragunawan/rest-service/code-structure)\n[![SensioLabsInsight](https://insight.sensiolabs.com/projects/8d1ecd53-bef1-4cca-b598-512676a54f58/small.png)](https://insight.sensiolabs.com/projects/8d1ecd53-bef1-4cca-b598-512676a54f58)\n\nProvides an implementation of the Guzzle Command library that uses services specification to describe web services.\n\nInstallation\n------------\n\nRequire the library with composer:\n\n``` bash\n$ composer require indragunawan/rest-service\n```\n\nComposer will install the library to your project’s `vendor/indragunawan/rest-service` directory.\n\nUsage\n-----\n\n```php\n\u003c?php\n\n// httpbin-v1.php\n\nreturn [\n    'name' =\u003e 'httpbin API',\n    'endpoint' =\u003e '{endpoint}',\n    'defaults' =\u003e [\n        'endpoint' =\u003e [\n            'rule' =\u003e 'required | url', // see: http://www.sirius.ro/php/sirius/validation/validation_rules.html\n            'defaultValue' =\u003e 'http://httpbin.org',\n        ],\n    ],\n    'operations' =\u003e [\n        'postTest' =\u003e [\n            'httpMethod' =\u003e 'POST', // header, uri, query, body\n            'requestUri' =\u003e '/post',\n            'request' =\u003e [\n                'type' =\u003e 'map', // map, list\n                'members' =\u003e [\n                    'Name' =\u003e [\n                        'locationName' =\u003e 'name',\n                        'type' =\u003e 'string', // string, integer, float, number, boolean, datetime\n                        'rule' =\u003e 'required',\n                    ],\n                    'CreatedAt' =\u003e [\n                        'type' =\u003e 'datetime',\n                        'defaultValue' =\u003e 'now',\n                        'format' =\u003e 'd M y',\n                    ],\n                ],\n            ],\n            'response' =\u003e [\n                'members' =\u003e [\n                    'url' =\u003e [\n                        'type' =\u003e 'string',\n                        'format' =\u003e 'format_%s',\n                    ]\n                ]\n            ],\n        ],\n    ],\n];\n```\n\n```php\nuse IndraGunawan\\RestService\\ServiceClient;\n\n    $config = [\n        'httpClient' =\u003e [\n            // use by GuzzleClient\n        ],\n        'defaults' =\u003e [\n            // default value for services specification\n        ],\n    ];\n    $cacheDir = __DIR__.'/../cache'; // optional, default: null\n    $debug = false; // optional, default: false\n\n    $service = new ServiceClient(__DIR__.'/httpbin-v1.php', $config, $cacheDir, $debug);\n    $result = $service-\u003epostTest([\n        'Name' =\u003e 'My Name',\n    ]);\n\n    echo $result['url']; // format_http://httpbin.org/post\n    // var_dump($result-\u003etoArray());\n```\n\nTodo\n----\n* Add more tests.\n* Add more documentation.\n* Parse Response to Model\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findragunawan%2Frest-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Findragunawan%2Frest-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findragunawan%2Frest-service/lists"}