lfybk666 / api
Example api
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/lfybk666/api
Requires
- php: ^8.2
- guzzlehttp/guzzle: ^7.8
Requires (Dev)
- phpunit/phpunit: ^11.1
This package is auto-updated.
Last update: 2025-12-31 00:17:18 UTC
README
PHP library for Example API interaction, includes Auth authorization and API methods.
1. Prerequisites
- PHP 8.2
2. Installation
The Example Api can be installed using Composer by running the following command:
composer require lfybk666/api
3. Initialization
Create ApiClient object using the following code:
$api = new \Lfybk666\Api\Client\ApiClient();
4. Authorization
The library provides the authorization by secret api token.
4.1. Authorization Code Flow
Auth Authorization Code Flow allows calling methods from the server side.
Create Auth object first:
$auth = new \Lfybk666\Api\Auth\Auth();
4.1.1. For getting user access key use following command:
$auth = new \Lfybk666\Api\Auth\Auth(); $accessToken = $auth->getAccessToken('example_api_key');
5. API Requests
5.1. Request sample
Example of calling method comments.get:
$apiClient = new ApiClient(); $comments = $apiClient->comments()->get($accessToken, [ 'page' => 1, ]);