https://github.com/gawsoftpl/rest-api-client-framework-php
https://github.com/gawsoftpl/rest-api-client-framework-php
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/gawsoftpl/rest-api-client-framework-php
- Owner: gawsoftpl
- License: mit
- Created: 2022-02-10T09:55:13.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2025-03-13T10:49:55.000Z (9 months ago)
- Last Synced: 2025-06-18T07:51:43.367Z (5 months ago)
- Language: PHP
- Size: 39.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# About
Rest client framework for your api client for PHP. In below example how to use this simple script
Write quick your api client
# Example
```php
api_key = $api_key;
$this->endpoint = getenv('WEBSHOTAPI_ENV') == 'dev' ? 'http://localhost:3000' : 'https://api.webshotapi.com/v1';
}
/**
* Download info about your account
*
* @return Response
* @throws ClientException
*/
function info(): Response{
$base = new Base($this);
return $base->method([
'path' => '/info',
'method' => 'GET'
]);
}
/**
* Set connection timeout in seconds
*
* @param $timeout
*/
function setTimeout(int $timeout){
$this->timeout = $timeout;
}
function getApiKey(): string{
return $this->api_key;
}
function getTimeout(): int{
return $this->timeout;
}
/**
* Set api endpoint. This method can use for test or if you want to change version of REST api
* @param $endpoint
*/
function setEndpoint(string $endpoint){
$this->endpoint = $endpoint;
}
function getEndpoint(): string{
return $this->endpoint;
}
function projects(): Project{
return new Project($this);
}
function projectsUrl(): ProjectUrl{
return new ProjectUrl($this);
}
}
```