ienaga / simple-api-client
simple api library.
Installs: 6 052
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Requires (Dev)
- phpunit/phpunit: 4.8.*
This package is auto-updated.
Last update: 2024-12-11 14:17:15 UTC
README
simple api library.
Composer
{ "require": { "ienaga/simple-api-client": "*" } }
Usage
GET (AWS ElasticSearch)
$client = new \SimpleApi\Client(); $json = $client ->setEndPoint("https://search-****.ap-northeast-1.es.amazonaws.com") ->setPath("/index_name/type_name/_search?q=user:kimchy") ->send();
POST (Google FireBase)
$client = new \SimpleApi\Client(); $json = $client ->addHeader("Authorization", "key=XXXXXXX") ->setEndPoint("https://fcm.googleapis.com/fcm/send") ->setMethod("POST") ->add("to", "INSTANCE_ID") ->add("priority", "high") ->add("content_available", true) ->add("notification", [ "title" => "title", "body" => "body", "badge" => 1 ]) ->send();
PUT (AWS ElasticSearch)
$client = new \SimpleApi\Client(); $json = $client ->setEndPoint("https://search-****.ap-northeast-1.es.amazonaws.com") ->setPath("/index_name/type_name") ->setMethod("PUT") ->add("status", 2) ->send();
DELETE (AWS ElasticSearch)
$client = new \SimpleApi\Client(); $json = $client ->setEndPoint("https://search-****.ap-northeast-1.es.amazonaws.com") ->setPath("/index_name") ->setMethod("DELETE") ->send();