bruno-canada / php-restclient-easytouse
PHP Rest API Client - Easy-to-Use
Requires
- php: ^5.5 || ^7.0
This package is auto-updated.
Last update: 2024-05-16 11:00:57 UTC
README
PHP Rest API Client - Easy-to-Use
PHP tool to connect to a REST API using design pattern Singleton and inheritance OOP.
📝 Table of Contents
🧐 About
This PHP tool is tested and working just fine. It makes your life really easy to connect and process information to a REST API with no extra packages or libraries.
It was created as a coding exercise applying Inheritance OOP (Object-oriented programming) and design pattern Singleton. It uses CURL to handle all the processes.
🏁 Getting Started
To use it is very simple, you can either directly download the project or use composer. There are no external dependencies.
If you decide to use composer just type:
composer require bruno-canada/php-restclient-easytouse
Prerequisites
PHP 5.5+
CURL mod enabled
🎈 Usage
Check the file "testing.php" or a real ready-to-use example below:
$endpointRoot = "https://restcountries.eu/rest/v2/"; $endpoint = $endpointRoot . "name/brazil"; try { $getSales = EASYREST\APIClient::get($endpoint); print_r($getSales); } catch (\Exception $e) { echo "Error: " . $e->getMessage(); }
⛏️ Built Using
- [PHP] (https://www.php.net/) PHP
- [CURL] (https://curl.haxx.se/) Transfering Data via CURL