PHPackages                             lakondev/simple-api-service - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. lakondev/simple-api-service

ActiveLibrary[API Development](/categories/api)

lakondev/simple-api-service
===========================

Generic API service to simplify HTTP requests in Laravel

v1.0.0(1y ago)01PHPPHP ^8.0

Since May 4Pushed 1y ago1 watchersCompare

[ Source](https://github.com/ahmadzaenimubarok/simple-api-service)[ Packagist](https://packagist.org/packages/lakondev/simple-api-service)[ RSS](/packages/lakondev-simple-api-service/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

Simple API Service
==================

[](#simple-api-service)

A lightweight, Guzzle-based HTTP API wrapper for Laravel. Simplifies making API calls without having to write boilerplate code for curl, headers, or token handling.

---

Installation
------------

[](#installation)

You can install the package via Composer:

```
composer require lakondev/simple-api-service
```

---

Usage
-----

[](#usage)

### 1. Initialize the Service

[](#1-initialize-the-service)

```
// Import the service class
use SimpleApiService\SimpleApiService;

// Create a new instance of the service
$api = new SimpleApiService();
```

### 2. Configuration

[](#2-configuration)

```
// Define the configuration array with base_url and optional token
$config = [
    'base_url' => 'https://jsonplaceholder.typicode.com', // Base URL of the API
    'token' => null, // Optional token (set if required by the API)
];
```

### 3. GET Request

[](#3-get-request)

```
// Create the complete URL for the specific endpoint
$url = $api->getApiUrl($config, 'todos/1');

// Prepare request options, including headers
$options = $api->getRequestOptions($config);

// Execute GET request to the API
$response = $api->executeRequest('GET', $url, $options);

// Output the API response
dd($response);
```

### 4. POST Request

[](#4-post-request)

```
// Define the endpoint URL
$url = $api->getApiUrl($config, 'posts');

// Define request body to send in POST request
$body = [
    'json' => [
        'title' => 'foo',
        'body' => 'bar',
        'userId' => 1,
    ]
];

// Merge headers with request body
$options = $api->getRequestOptions($config, $body);

// Send POST request
$response = $api->executeRequest('POST', $url, $options);

// Output the response
dd($response);
```

---

Requirements
------------

[](#requirements)

- PHP &gt;= 8.0
- Laravel 9+
- guzzlehttp/guzzle &gt;= 7.0

---

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance48

Moderate activity, may be stable

Popularity1

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

379d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4730ce870f7e53be4f33865035509211b9f7a2c4da8be0429b137bb886d5c2ab?d=identicon)[ahmadzaenimubarok](/maintainers/ahmadzaenimubarok)

---

Top Contributors

[![ahmadzaenimubarok](https://avatars.githubusercontent.com/u/72987106?v=4)](https://github.com/ahmadzaenimubarok "ahmadzaenimubarok (8 commits)")

### Embed Badge

![Health badge](/badges/lakondev-simple-api-service/health.svg)

```
[![Health](https://phpackages.com/badges/lakondev-simple-api-service/health.svg)](https://phpackages.com/packages/lakondev-simple-api-service)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
