- Notifications
You must be signed in to change notification settings - Fork1
🚀 Yusr: A lightweight, powerful PHP HTTP client inspired by Guzzle
License
mazesec/yusr
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
YusrClient is a robust and easy-to-use PHP HTTP client that simplifies making HTTP requests in your PHP applications. Built with modern PHP practices, it implements the PSR-18 HTTP Client interface and provides a fluent API for sending HTTP requests.
- 🔒 PSR-18 HTTP Client compliant
- 🛠 Singleton pattern implementation
- 🚦 Full HTTP method support (GET, POST, PUT, DELETE, PATCH)
- 🔄 Automatic retry mechanism with exponential backoff
- 🔧 Highly customizable request options
- 🧩 Intuitive fluent interface
- ⏱ Configurable timeouts
- 🔐 SSL verification support
composer require tal7aouy/yusr
useYusr\Http\YusrClient;// Get client instance$client = YusrClient::getInstance();// Make a GET request$response =$client->get('https://api.example.com/users');// Work with response$statusCode =$response->getStatusCode();$data =$response->getBody()->getContents();$headers =$response->getHeaders();
$client = YusrClient::getInstance(['timeout' =>30,'allow_redirects' =>true,'verify' =>true,'retry' => ['max_attempts' =>3,'delay' =>1000// milliseconds ]]);
$client->get(string$uri, array$options = []);$client->post(string$uri, array$options = []);$client->put(string$uri, array$options = []);$client->delete(string$uri, array$options = []);$client->patch(string$uri, array$options = []);
query
- Array of URL query parametersheaders
- Custom request headersbody
- Request body (for POST, PUT, PATCH)timeout
- Request timeout in secondsallow_redirects
- Follow redirects (boolean)verify
- SSL certificate verificationretry
- Retry configuration for failed requests
YusrClient includes a sophisticated retry mechanism with exponential backoff:
$client = YusrClient::getInstance(['retry' => ['max_attempts' =>3,'delay' =>1000,'multiplier' =>2 ]]);
Contributions are always welcome! Please read ourContributing Guide for details.
This project is licensed under theMIT License.
If you find this package helpful, please consider giving it a star ⭐️
About
🚀 Yusr: A lightweight, powerful PHP HTTP client inspired by Guzzle
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.