PHPackages                             fenoandria/laravel-api-integration - 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. fenoandria/laravel-api-integration

ActiveLibrary[API Development](/categories/api)

fenoandria/laravel-api-integration
==================================

This is my package laravel-api-integration

01PHP

Since Sep 17Pushed 1y ago1 watchersCompare

[ Source](https://github.com/FenoAndria/laravel-api-integration)[ Packagist](https://packagist.org/packages/fenoandria/laravel-api-integration)[ RSS](/packages/fenoandria-laravel-api-integration/feed)WikiDiscussions main Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

API Integration Package for Laravel
===================================

[](#api-integration-package-for-laravel)

This package provides a flexible and extendable API client to interact with any external APIs by dynamically configuring base URLs, API keys, and handling HTTP requests. It's built for Laravel using Spatie's package template and is designed to integrate with various third-party services.

Features
--------

[](#features)

- **Dynamic Configuration** : Supports environment-based API configuration (base URL, API key).
- **Flexible HTTP Methods** : Allows GET, POST, PUT, DELETE requests with ease.
- **Extensible Design** : Easily add support for new APIs without altering the core package.
- **Service Container Integration** : Uses Laravel's service container for dependency injection and flexibility.
- **Mockable for Testing** : Easily test API responses with Guzzle mock handlers.

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

[](#installation)

```
composer require fenoandria/laravel-api-integration:dev-main

```

### Publish the Configuration

[](#publish-the-configuration)

After installation, publish the configuration file:

```
php artisan vendor:publish --provider="FenoAndria\LaravelApiIntegration\LaravelApiIntegrationServiceProvider"

```

This will create the config/api-integration.php file, where you can set your API base URL and key.

Configure the .env file

Add your API credentials in your .env file:

- **API\_BASE\_URL** =
- **API\_KEY** = your-api-key

Usage
-----

[](#usage)

Via the Service Container

- You can inject the ApiClient into your services, controllers, or jobs via Laravel's service container:

```
$apiClient = app(ApiClient::class);

$response = $apiClient->get('your-endpoint', ['param' => 'value']);

dd($response);
```

- Manual Instantiation

For simple use cases, you can instantiate the ApiClient manually:

```
$apiClient = new ApiClient('https://api.yourservice.com', 'your-api-key');

$response = $apiClient->get('your-endpoint', ['param' => 'value']);

dd($response);
```

### Handling Requests

[](#handling-requests)

The ApiClient supports the common HTTP methods:

**GET request:**

```
$response = $apiClient->get('endpoint', ['param' => 'value']);
```

**POST request:**

```
$response = $apiClient->post('endpoint', ['param' => 'value']);
```

**PUT request:**

```
$response = $apiClient->put('endpoint', ['param' => 'value']);
```

**DELETE request:**

```
$response = $apiClient->delete('endpoint');
```

### Testing

[](#testing)

The package includes PHPUnit tests. To run tests, ensure that you have a .env.testing file configured if your package relies on environment variables.

You can mock HTTP requests using Guzzle's mock handler in your tests. Here's an example:

```
use GuzzleHttp\Handler\MockHandler;
use GuzzleHttp\Psr7\Response;
use GuzzleHttp\HandlerStack;
use FenoAndria\LaravelApiIntegration\Services\ApiClient;

$mock = new MockHandler([
    new Response(200, [], json_encode(['data' => 'mocked data']))
]);

$handlerStack = HandlerStack::create($mock);
$httpClient = new \GuzzleHttp\Client(['handler' => $handlerStack]);

$apiClient = new ApiClient('https://api.mockservice.com', 'mock-api-key', $httpClient);

$response = $apiClient->get('endpoint');

$this->assertEquals('mocked data', $response['data']);
```

Extending the Package
---------------------

[](#extending-the-package)

You can extend this package to support additional APIs by adding more methods or modifying the existing service class to suit your needs.

Contributing
------------

[](#contributing)

Feel free to fork this package and contribute by submitting pull requests. Any suggestions for improvements are welcome! License

This package is open-sourced software licensed under the MIT license.

###  Health Score

13

—

LowBetter than 1% of packages

Maintenance28

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity17

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/102666055?v=4)[Fenomanjato](/maintainers/FenoAndria)[@FenoAndria](https://github.com/FenoAndria)

---

Top Contributors

[![FenoAndria](https://avatars.githubusercontent.com/u/102666055?v=4)](https://github.com/FenoAndria "FenoAndria (7 commits)")

### Embed Badge

![Health badge](/badges/fenoandria-laravel-api-integration/health.svg)

```
[![Health](https://phpackages.com/badges/fenoandria-laravel-api-integration/health.svg)](https://phpackages.com/packages/fenoandria-laravel-api-integration)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k15](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

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