/peer-review--MicroBridge-PHP

PHP's lightweight microservice/API communicator

Primary LanguagePHPMIT LicenseMIT

MicroBridge-PHP
PHP's lightweight microservices/API communicator

MicroBridge-PHP is a lightweight (less than 1000 lines of code) PHP 7.1 tool for issuing intern-API requests.

Installation

Install by running:

composer require lfvcodes/MicroBridge-PHP

📦 Using Without Composer

If you're not using Composer, you can manually integrate MicroBridge into your project by following these steps:

1. 📁 Copy the Files

Download or clone the repository and copy the src/ folder into your project:


2. 📄 Manually Include the Class

In your main file (index.php or similar), include the class file and use the namespace:

Usage

Using methods with params:

<?php
  use MicroBridge\MicroBridge;
  $client = new MicroBridge($method = 'POST'); //Can use POST/PUT/PATCH/DELETE
  $response = $client->request($urlOrPath,$arrayParams);
  print_r($response);
?>

Using URL Params with GET:

<?php
  use MicroBridge\MicroBridge;
  $client = new MicroBridge($method = 'GET');
  $response = $client->request('../api/index.php?id=4');
  print_r($response);
?>