PHPackages                             uhin/laravel\_api - 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. uhin/laravel\_api

ActiveLibrary[API Development](/categories/api)

uhin/laravel\_api
=================

An API helper library for Laravel.

4.0.0(8mo ago)011.1k↓33.3%1MITPHP

Since Feb 20Pushed 6mo agoCompare

[ Source](https://github.com/UHIN/laravel_api)[ Packagist](https://packagist.org/packages/uhin/laravel_api)[ RSS](/packages/uhin-laravel-api/feed)WikiDiscussions v4 Synced 1mo ago

READMEChangelog (8)Dependencies (6)Versions (92)Used By (0)

laravel\_api
============

[](#laravel_api)

Devs: To create a new release for composer you need to make your commit, add a tag (new version number), and then push the commit and the tag.

In PHPStorm: Commit, click on log, right click on commit and add tag, push (check push tags).

For development:

In a service using this library you will make two changes to the composer.json to do development.

First change the version of the require for this library to either: "dev-master", "1.x-dev", or "2.x-dev" - depending on which branch you are working on.

Second add this block of code to your composer.json (editing the path):

```
"repositories": [
    {
        "type": "path",
        "url": "/Users/rmclelland/Projects/laravel_api"
    }
]

```

Run composer update from your project directory. This will create a symlink between the library and the project using this library.

```
composer update uhin/laravel_api

```

Upgrade guides
==============

[](#upgrade-guides)

Review these documents when upgrading versions.

[V1 to V2 Upgrade Guide](./docs/v2-upgrade-notes.md)

[V2 to V3 Upgrade Guide](./docs/v3-upgrade-notes.md)

[V3 to V4 Upgrade Guide](./docs/v4-upgrade-notes.md)

Using Rabbit
============

[](#using-rabbit)

Rabbit Builders
---------------

[](#rabbit-builders)

`php artisan uhin:make:rabbit-builder`

The constructor stubs out the configuration for the builder. Modify the constructor to suit your needs. In previous versions of the builder the changes were made in the builder method. This is no longer required but, if needs be, the builder can still be overridden.

```
public function __construct()
{
        parent::__construct();

        // You can overwrite these parent values
        // $this->exchange = config('uhin.rabbit.exchange');
        // $this->queue = config('uhin.rabbit.queue');
        // $this->routingKey = config('uhin.rabbit.routing_key');
        // $this->connectionName = 'default';
}
```

Rabbit Sender
-------------

[](#rabbit-sender)

### Single Messages

[](#single-messages)

To send a message to RabbitMQ there are a few ways to do so. The most basic method uses the default exchange, and routing key from the `.env`.

```
(new RabbitSender)->send(json_encode([
       'job_id' => '12312312',
       'source' => 'sftp',
       'filename' => 'test-file.x12',
       'data' => 'alskfl'
   ]));
```

Another method to send to RabbitMQ takes a RabbitBuilder as a parameter. The sender can now use the parameters of the builder to determine the exchange and routing key.

```
$rabbit = new RabbitSender(true, new MPILookupQueueBuilder());
$rabbit->send(json_encode($message));
```

The properties of a sender can also be overridden.

```
$rabbit->setExchange(config('uhin.workers.lookup_mpi_exchange'));
$rabbit->setRoutingKey(config('uhin.workers.lookup_mpi_routing_key'));
```

### Batch Sending

[](#batch-sending)

Same usage as single message sending. The `sendBatch()` method takes an array of messsages and send them in batch. Performance for larger quantities of messages is significantly better.

Rabbit Receiver
---------------

[](#rabbit-receiver)

The receiver can also take a builder and fills the properties for connecting to RabbitMQ.

Starting/Stopping/Draining Workers
----------------------------------

[](#startingstoppingdraining-workers)

### Starting

[](#starting)

`php artisan uhin:workers:start`

### Stopping

[](#stopping)

`php artisan uhin:workers:stop`

### Drain

[](#drain)

`php artisan uhin:workers:drain`

Using Twilio SendGrid
=====================

[](#using-twilio-sendgrid)

First, make sure that you have specified the following config values. The `SendGridTemplate` class will use these configs:

- `config('mail.from.address')`
- `config('mail.from.name')`
- `config('mail.sendgrid.api-key')`

Templates
---------

[](#templates)

Example of how to send an email using a SendGrid email template and the `SendGridTemplate` class:

```
$templateId = config('mail.sendgrid.template.test');
$email = new SendGridTemplate($templateId);

// Send the email to user1, and CC user2 and user3
$metaDataA = new \SendGrid\Mail\Personalization();
$metaDataA->addDynamicTemplateData('sendgrid_var_1', 'custom data value 1');
$metaDataA->addDynamicTemplateData('sendgrid_var_2', 'custom data value 2');
$metaDataA->addCc(new \SendGrid\Mail\Cc('user2@test.com', 'User 2'));
$metaDataA->addCc(new \SendGrid\Mail\Cc('user3@test.com', 'User 3'));
$email->addRecipient('user1@test.com', 'User 1', $metaDataA);

// Send the email to user4, and BCC user5
$metaDataB = new \SendGrid\Mail\Personalization();
$metaDataB->addDynamicTemplateData('sendgrid_var_1', 'custom data value 3');
$metaDataB->addDynamicTemplateData('sendgrid_var_2', 'custom data value 4');
$metaDataB->addBcc(new \SendGrid\Mail\Bcc('user5@test.com', 'User 5'));
$email->addRecipient('user4@test.com', 'User 4', $metaDataB);

// Send out the email template with data attached to it
$email->send();
```

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance64

Regular maintenance activity

Popularity25

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity79

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Every ~32 days

Recently: every ~170 days

Total

87

Last Release

263d ago

Major Versions

1.1.19 → 2.0.02018-10-25

1.1.20 → 2.0.12018-11-01

2.2.1 → 3.0.02021-05-11

v3.x-dev → v4.x-dev2025-08-25

### Community

Maintainers

![](https://www.gravatar.com/avatar/899e507c69e61ef15d5532164afe29452d9e06075de3eb1a6265e538c32ac21d?d=identicon)[rmclellanduhin](/maintainers/rmclellanduhin)

---

Top Contributors

[![rmclellanduhin](https://avatars.githubusercontent.com/u/36676665?v=4)](https://github.com/rmclellanduhin "rmclellanduhin (54 commits)")[![cameronhejazifar](https://avatars.githubusercontent.com/u/72213537?v=4)](https://github.com/cameronhejazifar "cameronhejazifar (39 commits)")[![zlobato](https://avatars.githubusercontent.com/u/30511504?v=4)](https://github.com/zlobato "zlobato (21 commits)")[![behrhartuhin](https://avatars.githubusercontent.com/u/30664560?v=4)](https://github.com/behrhartuhin "behrhartuhin (10 commits)")[![chejaziuhin](https://avatars.githubusercontent.com/u/36676697?v=4)](https://github.com/chejaziuhin "chejaziuhin (9 commits)")[![trbute](https://avatars.githubusercontent.com/u/103962894?v=4)](https://github.com/trbute "trbute (3 commits)")[![kclayton925](https://avatars.githubusercontent.com/u/11861818?v=4)](https://github.com/kclayton925 "kclayton925 (2 commits)")[![vashery](https://avatars.githubusercontent.com/u/7144653?v=4)](https://github.com/vashery "vashery (1 commits)")

### Embed Badge

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

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

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[knuckleswtf/scribe

Generate API documentation for humans from your Laravel codebase.✍

2.3k12.2M45](/packages/knuckleswtf-scribe)[wheelpros/fitment-platform-api

Magento 2 (Open Source)

12.1k1.2k](/packages/wheelpros-fitment-platform-api)[blair2004/nexopos

The Free Modern Point Of Sale System build with Laravel, TailwindCSS and Vue.js.

1.2k2.3k](/packages/blair2004-nexopos)

PHPackages © 2026

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