Skip to content

Commit a0edba0

Browse files
committed
added information
1 parent ebde62e commit a0edba0

1 file changed

Lines changed: 55 additions & 4 deletions

File tree

README.MD

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,64 @@
1-
# Adapter Guzzle for CodeIgniter 4
1+
# Support Adapter Guzzle for CodeIgniter 4
22

3-
Library ini menyediakan integrasi **Adapter Guzzle** dengan framework **CodeIgniter 4**.
4-
Membantu developer dengan mudah melalui Service Facade.
3+
Support Adapter is a lightweight package that provides a Guzzle HTTP Adapter with a flexible approach for both CodeIgniter 4 and standalone PHP projects.
54

6-
---
5+
Its main goal is to simplify HTTP communication with external APIs through the PSR-7 and PSR-18 standards, keeping your code clean, consistent, and testable.
76

87
## 📦 Installation
98

109
1. **Install via Composer**
1110
```bash
1211
composer require reactmore/support-adapter
1312
```
13+
14+
## 📖 Example Usage
15+
```php
16+
use Reactmore\SupportAdapter\Adapter\Guzzle;
17+
use Reactmore\SupportAdapter\Adapter\Auth\None;
18+
19+
// Auth adapter (no authentication)
20+
$auth = new None();
21+
22+
// Initialize the adapter
23+
$adapter = new Guzzle($auth, 'https://api.example.com/');
24+
25+
// Perform a GET request
26+
$response = $adapter->get('users');
27+
28+
// Get response body
29+
$data = json_decode($response->getBody()->getContents(), true);
30+
31+
32+
print_r($data);
33+
34+
```
35+
36+
## 🚀 CodeIgniter 4 Integration
37+
38+
With Support Adapter, you can register a service in app/Config/Services.php for dependency injection into your CodeIgniter 4 project:
39+
40+
```php
41+
public static function apiClient($getShared = true)
42+
{
43+
if ($getShared) {
44+
return static::getSharedInstance('apiClient');
45+
}
46+
47+
$auth = new \Reactmore\SupportAdapter\Adapter\Auth\None();
48+
return new \Reactmore\SupportAdapter\Adapter\Guzzle($auth, 'https://api.example.com/');
49+
}
50+
51+
```
52+
## 🤝 Contributing
53+
54+
Contributions are always welcome!
55+
56+
If you’d like to improve Support Adapter, here’s how you can help:
57+
58+
```
59+
1. Fork the repository
60+
2. Create a new feature branch (git checkout -b feature/my-new-feature)
61+
3. Commit your changes (git commit -m 'Add new feature')
62+
4. Push to the branch (git push origin feature/my-new-feature)
63+
5. Open a Pull Request
64+
```

0 commit comments

Comments
 (0)