Download the PHP package reactphp-x/micro-service without Composer
On this page you can find all versions of the php package reactphp-x/micro-service. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package micro-service
ReactPHP X Micro Service
A high-performance service distribution system built with ReactPHP, designed to distribute service calls across multiple master nodes efficiently and evenly.
Features
- Even distribution of service calls across available master nodes
- Real-time load balancing based on call counts
- Input validation for service calls
- JSON-based API interface
- Built with ReactPHP for high performance and non-blocking I/O
Installation
Install via Composer:
Requirements
- PHP 8.0 or higher
- ReactPHP HTTP ^1.11
- ReactPHP X Register Center ^1.0
Usage
Basic Setup
Making Service Calls
Send a POST request to your server with the following JSON structure:
Response Format
For successful requests, you'll receive a response with the distributed calls:
For invalid requests, you'll receive a 400 Bad Request response:
error result
success result
Error Handling
The service validates all incoming requests and will return appropriate error messages for:
- Invalid server_calls format (must be an array)
- Invalid service names (must be strings)
- Invalid call format (must be arrays with method and params)
- Missing or invalid method names
- Missing or invalid parameters
Load Distribution
The service automatically distributes calls across available master nodes using the following strategy:
- Maintains a count of calls per master node
- Assigns new calls to the least loaded node
- Ensures even distribution of load across all available nodes
License
MIT
Author
wpjscc [email protected]
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
All versions of micro-service with dependencies
wpjscc/react-stream-json Version ^1.0
react/http Version ^1.11