Skip to content

A lightweight, flexible PHP REST client for consuming RESTful web services. Designed for simplicity and ease of use, this package offers a clean interface for making API requests with customizable configurations.

Notifications You must be signed in to change notification settings

ay4t/php-rest-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multipurpose PHP Rest Client

A multipurpose PHP rest client for consuming RESTful web services. This package is designed to be very simple and easy to use.

Installation

You can install the package via composer:

composer require ay4t/php-rest-client

Description

Example usage of the Client class.

Example Usage

$config = new Config();
$config->setBaseUri('https://api.groq.com/openai/v1')
    ->setApiKey('your-api-key-here')
    // optional
    ->setSecretKey('your-secret-key-here');

$client = new Client($config);
$response = $client->cmd('GET', 'models');

echo '<pre>';
print_r($response);
echo '</pre>';

or

$cmd = $client->cmd('POST', 'chat/completions', [
    'model' => 'llama-3.1-70b-versatile',
    'messages' => [
        [
            'role' => 'user',
            'content'  => 'hi, why is sea water salty?',
        ]
    ]
]);

echo '<pre>';
print_r($cmd);
echo '</pre>';

About

A lightweight, flexible PHP REST client for consuming RESTful web services. Designed for simplicity and ease of use, this package offers a clean interface for making API requests with customizable configurations.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages