https://github.com/fintech-systems/api-helpers
Abstraction of generic API calls that are used across multiple possibly dissimilar applications.
https://github.com/fintech-systems/api-helpers
php-api
Last synced: 13 days ago
JSON representation
Abstraction of generic API calls that are used across multiple possibly dissimilar applications.
- Host: GitHub
- URL: https://github.com/fintech-systems/api-helpers
- Owner: fintech-systems
- License: mit
- Created: 2021-10-15T05:58:03.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-11-18T08:28:28.000Z (about 1 year ago)
- Last Synced: 2025-07-26T22:26:01.447Z (7 months ago)
- Topics: php-api
- Language: PHP
- Homepage:
- Size: 57.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
# Laravel API Helpers
[](https://packagist.org/packages/fintech-systems/laravel-api-helpers)
[](https://github.com/fintech-systems/laravel-api-helpers/actions?query=workflow%3Arun-tests+branch%3Amain)
[](https://github.com/fintech-systems/laravel-api-helpers/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain)
[](https://packagist.org/packages/fintech-systems/laravel-api-helpers)
[](https://github.com/fintech-systems/laravel-api-helpers/blob/main/LICENSE.md)
---
## A helper library to facilitate working with APIs
### API: Get, Post, Delete
`public function get(string $url, array $header = [])`
`public function post(string $url, string|array $postFields, array $header = [])`
`public function delete(string $url, string|array $postFields = '', array $header = [])`
Laravel API Helper Command - facilitates caching JSON API responses
Example:
```php
class UserCommand extends LaravelApiHelpersCommand
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'api:get-users {--cached}';
...
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
if ($file = $this->checkCachedFileExists()) {
$this->info('A cached API result file was returned');
return $file;
}
$result = file_put_contents($this->cachedFile, Api::getUsers());
$this->info('The API command was successful');
return $result;
}
```
---
## Installation
You can install the package via composer:
```bash
composer require fintech-systems/laravel-api-helpers
```
## Usage
### WhatsApp to WHMCS phone number conversion
```php
$api = new Api();
$result = $api->convertWhatsAppNumberToWhmcsPhoneNumber('27823096710');
expect($result)->toEqual('+27.82 309 6710');
$api = new Api();
$result = $api->convertWhatsAppNumberToWhmcsPhoneNumber('14085551234');
expect($result)->toEqual('+1.408-555-1234');
```
## Testing
```bash
composer test
```
## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Contributing
Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.
## Security Vulnerabilities
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
## Credits
- [Eugene van der Merwe](https://github.com/fintech-systems)
- [All Contributors](../../contributors)
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.