PHPackages                             star-insure/api-client - 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. star-insure/api-client

ActiveLibrary[API Development](/categories/api)

star-insure/api-client
======================

Star Insure API Client

8.1.3(5mo ago)0612MITPHPPHP ^8.1

Since Apr 12Pushed 5mo agoCompare

[ Source](https://github.com/star-insure/api-client)[ Packagist](https://packagist.org/packages/star-insure/api-client)[ Docs](https://github.com/star-insure/api-client)[ RSS](/packages/star-insure-api-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (85)Used By (0)

Star Insure API Client
======================

[](#star-insure-api-client)

A package for Laravel apps that includes a wrapper for the Star Inure API and scaffolds out routes, controllers and middleware for authenticating with the Star auth app.

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

[](#installation)

You can install the package via composer:

```
composer require star-insure/api-client
```

Add these values to your `.env` file:

```
# API
SIS_API_URL=http://api.starinsure.test
SIS_API_AUTH_STRATEGY=user|app
SIS_API_TOKEN=dev
SIS_API_GROUP_ID=2

# OAuth client
SIS_API_CLIENT_ID=app
SIS_API_CLIENT_SECRET=secret
```

### Publish config:

[](#publish-config)

```
php artisan vendor:publish --tag=starinsure
```

### Append routes

[](#append-routes)

Add the below line to your `/routes/web.php` file.

```
require __DIR__.'/oauth.php';
```

Usage
-----

[](#usage)

### API

[](#api)

Call the Star API by instantiating a new client, or using the `StarInsure\Api\Facades\StarApi` facade.

```
StarApi::get('/users/me');
StarApi::get('/users');
```

### Auth

[](#auth)

Use Laravel's provided "auth" middleware.

```
Route::get('/protected', function () {
    return 'Only authenticated users can see this.';
})->middleware('auth');
```

Or a route group:

```
Route::middleware(['auth'])->group(function () {
    Route::get('/protected', function () {
        return "Only authenticated users can see this.";
    });
});
```

The user will automatically be redirected to the auth server if no valid session, and sent back to their request destination after successfully logging in.

### Helper functions

[](#helper-functions)

Following the Laravel style, you also have the option of using helper functions. To register the auth helper so it overrides Laravel's built-in `auth()` functions, follow the steps below.

This package has a dependency on `funkjedi/composer-include-files`, which allows you to load your own functions prior to any of your dependencies global functions.

Create a `helpers.php` file within the `app` directory (or edit your existing one):

```
// We use this helper purely to help the IDE recognise the global function's return type
if (! function_exists('auth') && isset($_ENV['APP_ENV']) && $_ENV['APP_ENV'] === 'ide') {
    /**
     * Get the available auth instance.
     */
    function auth(): StarInsure\Api\StarAuthManager
    {
        return new \StarInsure\Api\StarAuthManager(
            app(),
            config('star.api_url').'/api/'.config('star.version'),
        );
    }
}

if (! function_exists('api')) {
    /**
     * Global helper to create an instance of the StarApi client.
     */
    function api(string $token = null)
    {
        return new \StarInsure\Api\StarApi(
            auth_strategy: config('star.auth_strategy'),
            version: config('star.version'),
            apiTokenOverride: $token,
        );
    }
}

if (! function_exists('appApi')) {
    /**
     * An instance of the API client for non-authenticated routes
     */
    function appApi()
    {
        return new \StarInsure\Api\StarApi(
            'app',
            config('star.version'),
            config('star.token'),
            config('star.group_id')
        );
    }
}
```

Autoload your helpers file in `composer.json`:

```
"autoload": {
    ...
    "files": [
        "app/helpers.php"
    ]
},
```

After adding the helpers file to composer.json, you'll need to dump the autoloader

```
composer dump-autoload

```

You can now use the global helper functions and not worry about namespaces/imports.

```
$user = auth()->user();
$id = auth()->id();
$group = auth()->group();
$role = auth()->role();
$permissions = auth()->permissions();
$context = auth()->context();

$apiResponse = api()->get('/users/me', [ 'include' => 'groups' ]);
```

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance70

Regular maintenance activity

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 92.8% 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

Every ~16 days

Recently: every ~89 days

Total

83

Last Release

169d ago

Major Versions

3.0.3 → 4.0.02023-02-14

4.1.0 → 5.0.02023-09-04

5.1.2 → 6.0.02023-10-10

6.4.1 → 7.0.02024-05-31

7.1.1 → 8.0.02024-12-09

PHP version history (2 changes)1.0.0PHP ^7.4|^8.0

4.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/02e06d939be026746151b711568e4397d5f9f4d1b6ba54cab3db12f14ccca04c?d=identicon)[alexclark-nz](/maintainers/alexclark-nz)

---

Top Contributors

[![alexthekiwi](https://avatars.githubusercontent.com/u/38124722?v=4)](https://github.com/alexthekiwi "alexthekiwi (90 commits)")[![carlostarinsure](https://avatars.githubusercontent.com/u/131621345?v=4)](https://github.com/carlostarinsure "carlostarinsure (6 commits)")[![nzbasic](https://avatars.githubusercontent.com/u/54062686?v=4)](https://github.com/nzbasic "nzbasic (1 commits)")

---

Tags

star-insure

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/star-insure-api-client/health.svg)

```
[![Health](https://phpackages.com/badges/star-insure-api-client/health.svg)](https://phpackages.com/packages/star-insure-api-client)
```

###  Alternatives

[spatie/laravel-route-attributes

Auto register routes using PHP attributes

879963.2k18](/packages/spatie-laravel-route-attributes)[andreaselia/laravel-api-to-postman

Generate a Postman collection automatically from your Laravel API

1.0k586.2k3](/packages/andreaselia-laravel-api-to-postman)[scalar/laravel

Render your OpenAPI-based API reference

6183.9k2](/packages/scalar-laravel)[neuron-core/neuron-laravel

Official Neuron AI Laravel SDK.

10710.0k](/packages/neuron-core-neuron-laravel)[codebar-ag/laravel-docuware

DocuWare integration with Laravel

1221.1k](/packages/codebar-ag-laravel-docuware)[codebar-ag/laravel-zammad

Zammad integration with Laravel

106.1k](/packages/codebar-ag-laravel-zammad)

PHPackages © 2026

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