{"id":20538296,"url":"https://github.com/basemkhirat/api","last_synced_at":"2025-04-14T07:50:50.411Z","repository":{"id":56950482,"uuid":"68649893","full_name":"basemkhirat/api","owner":"basemkhirat","description":"A guzzle interface to make API calls for laravel 5 applications.","archived":false,"fork":false,"pushed_at":"2017-12-06T09:12:50.000Z","size":7,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-27T21:23:24.096Z","etag":null,"topics":["api","guzzle","guzzle-interface","http-client"],"latest_commit_sha":null,"homepage":"http://basemkhirat.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/basemkhirat.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-19T21:53:36.000Z","updated_at":"2024-03-25T00:44:29.000Z","dependencies_parsed_at":"2022-08-21T03:40:16.709Z","dependency_job_id":null,"html_url":"https://github.com/basemkhirat/api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basemkhirat%2Fapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basemkhirat%2Fapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basemkhirat%2Fapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basemkhirat%2Fapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/basemkhirat","download_url":"https://codeload.github.com/basemkhirat/api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248844048,"owners_count":21170486,"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":["api","guzzle","guzzle-interface","http-client"],"created_at":"2024-11-16T00:46:10.546Z","updated_at":"2025-04-14T07:50:50.349Z","avatar_url":"https://github.com/basemkhirat.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"### A guzzle interface to make API calls for laravel 5 applications.\n\n##### 1) Install package via composer:\n\n\tcomposer require basemkhirat/api\n\n##### 2) Add package service provider:\n\n\tBasemkhirat\\API\\APIServiceProvider::class\n\t\n##### 3) Add package alias:\n\n\t'API' =\u003e Basemkhirat\\API\\Facades\\API::class\n\t\n##### 4) Publishing:\n    \n    php artisan vendor:publish\n\t\n### Usage:\n\n#### Requests with request uri:\n\n    // $config is optional\n    \n    GET Request     :  API::get(\"users/show\", $config)\n    POST Request    :  API::post(\"users/create\", $config)\n    PUT Request     :  API::put(\"users/update\", $config)\n    DELETE Request  :  API::delete(\"users/delete\", $config)\n\n#### Or using full url:\n\n    // $config is optional\n    \n    GET Request     :  API::get(\"http://httpbin.org/get\", $config)\n    POST Request    :  API::post(\"http://httpbin.org/post\", $config)\n    PUT Request     :  API::put(\"http://httpbin.org/put\", $config)\n    DELETE Request  :  API::delete(\"http://httpbin.org/delete\", $config)\n\n#### Getting body content text:\n\n    API::get(\"get\", $config)-\u003egetBody()-\u003egetContent()\n\n#### Getting body content array:\n\n    API::get(\"get\", $config)-\u003etoArray()\n\n#### Getting status code:\n\n    API::get(\"get\", $config)-\u003egetStatusCode()   // int 200\n\n    \n#### Multiple drivers:\n\nIn api.php config file, repeat `default` array block\n     \n     return [\n     \n         // Called using API::driver(\"default\")-\u003eget($uri) or API::get($uri) directly\n         \n         \"default\" =\u003e [\n            'base_uri' =\u003e 'http://site1.dev/api/',\n            ....\n            ...\n            .\n         ],\n         \n         // Called using API::driver(\"another\")-\u003eget($uri)\n         \n         \"another\" =\u003e [\n            'base_uri' =\u003e 'http://site2.dev/api/',\n            ....\n            ...\n            .\n          ]\n     ];\n     \n     \n#### Native guzzle calling:\n\n\n    //API::guzzle() return guzzle client object\n    \n    API::guzzle()-\u003eget(\"get\", $config)-\u003egetBody()-\u003egetContents();\n    \n   For more guzzle request options\n   \n   Browse Guzzle docs : [Guzzle Docs](http://docs.guzzlephp.org/en/latest/request-options.html#allow-redirects)\n\n`Good luck`\n\n`Dont forget to send a feedback..`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasemkhirat%2Fapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbasemkhirat%2Fapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasemkhirat%2Fapi/lists"}