PHPackages                             rdcstarr/laravel-easyapi - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. rdcstarr/laravel-easyapi

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

rdcstarr/laravel-easyapi
========================

A simple settings package for Laravel.

v1.1.5(7mo ago)015MITPHPPHP ^8.0

Since Sep 18Pushed 7mo agoCompare

[ Source](https://github.com/rdcstarr/laravel-easyapi)[ Packagist](https://packagist.org/packages/rdcstarr/laravel-easyapi)[ Docs](https://github.com/rdcstarr/laravel-easyapi)[ RSS](/packages/rdcstarr-laravel-easyapi/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (12)Versions (16)Used By (0)

Laravel EasyAPI
===============

[](#laravel-easyapi)

[![Latest Version on Packagist](https://camo.githubusercontent.com/1a48ea407cf118d012229b862cd795797cf9b38f2c63317ab90644d8ca773571/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72646373746172722f6c61726176656c2d656173796170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rdcstarr/laravel-easyapi)[![Tests](https://camo.githubusercontent.com/2181326972471445ce0651a394a9dc758ff2c532a8b094da673235f82c724589/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f72646373746172722f6c61726176656c2d656173796170692f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/rdcstarr/laravel-easyapi/actions)[![Code Style](https://camo.githubusercontent.com/40f1163885d713feac3ada8c5f063de660808ed36cf234eb9bb62acbf7eef3c4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f72646373746172722f6c61726176656c2d656173796170692f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/rdcstarr/laravel-easyapi/actions)[![Downloads](https://camo.githubusercontent.com/a16f91cef550cbf38e7f2a65d9507228c7ddab2675fdd4c7a194fc776eb8b80a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72646373746172722f6c61726176656c2d656173796170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rdcstarr/laravel-easyapi)

> Lightweight package for managing **API keys** in Laravel — with middleware protection, logging and simple CLI tools.

---

✨ Features
----------

[](#-features)

- 🔑 API key management — generate, list, reveal and delete API keys via an artisan command or programmatically.
- 🛡 Middleware protection — a lightweight middleware validates Bearer tokens on incoming requests.
- 📈 Usage metrics — each key tracks an access count and API access is logged to `api_logs`.
- 🔒 Secure keys — keys are generated using SHA-256 with unique identifiers to avoid collisions.
- ⚙️ Facade &amp; manager — programmatic API via the `EasyApi` facade or the `EasyApiManager` service.
- 🧪 Test-friendly — models and factories included to make testing straightforward.
- 📦 Migrations included — package ships migrations for `api` and `api_logs` tables and can be published.

---

📦 Installation
--------------

[](#-installation)

```
composer require rdcstarr/laravel-easyapi
```

### Automatic Installation (Recommended)

[](#automatic-installation-recommended)

Run the install command to publish and run the migrations:

```
php artisan easyapi:install
```

### Manual Installation

[](#manual-installation)

Alternatively, you can install manually:

1. Publish the migrations:

```
php artisan vendor:publish --tag=easyapi-migrations
```

2. Run the migrations:

```
php artisan migrate
```

The package registers a singleton manager and console commands. It will also register route groups if you provide `routes/api.php` or `routes/web.php`.

🔑 Usage
-------

[](#-usage)

Facade examples (programmatic):

```
use Rdcstarr\EasyApi\Facades\EasyApi;

// Generate a new API key (returns the Api model)
$api = EasyApi::createKey();
$fullKey = $api->key; // show and store this securely

// Validate a key (returns bool)
$isValid = EasyApi::validateKey($fullKey);

// Delete a key
EasyApi::deleteKey($fullKey);
```

Middleware usage:

- The package provides `Rdcstarr\EasyApi\Middleware\EasyApiMiddleware` which checks for a Bearer token and validates it against the `api` table. If valid, it logs the request and increments the access count.

Apply it to a route or route group:

```
Route::middleware([\Rdcstarr\EasyApi\Middleware\EasyApiMiddleware::class])->group(function () {
    Route::get('/protected', function () {
        return ['ok' => true];
    });
});
```

Database schema:

- `api` table: id, key (unique), access\_count, timestamps
- `api_logs` table: id, api\_id, endpoint, ip\_address, user\_agent, timestamps

Artisan CLI:

The package exposes a single console command: `php artisan easyapi` with the following actions:

- generate — create a new API key
- delete --key=KEY — delete an API key (confirmation required)
- list — display stored API keys (masked) with access counts
- reveal --id=ID — reveal the full API key for a given id

Examples:

```
php artisan easyapi generate
php artisan easyapi list
php artisan easyapi delete --key="qwerty_..."
php artisan easyapi reveal --id=1
```

Notes:

- Generated keys must be stored securely when created — the `generate` command shows the full key once.
- The command output masks keys in listings for safety; use `reveal` to show the full value when necessary.

🧪 Testing
---------

[](#-testing)

Run the package tests:

```
composer test
```

The package provides models (`Api`, `ApiLog`) and factories to make writing tests simpler.

📖 Resources
-----------

[](#-resources)

- [Changelog](CHANGELOG.md) for more information on what has changed recently.

👥 Credits
---------

[](#-credits)

- [Rdcstarr](https://github.com/rdcstarr)

📜 License
---------

[](#-license)

- [License](LICENSE.md) for more information.

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance64

Regular maintenance activity

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

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

Every ~5 days

Recently: every ~14 days

Total

15

Last Release

220d ago

### Community

Maintainers

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

---

Top Contributors

[![rdcstarr](https://avatars.githubusercontent.com/u/42062586?v=4)](https://github.com/rdcstarr "rdcstarr (16 commits)")

---

Tags

laravelSettingsgroupsRdcstarrlaravel-easyapi

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/rdcstarr-laravel-easyapi/health.svg)

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

###  Alternatives

[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

329530.5k29](/packages/codewithdennis-filament-select-tree)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

124603.0k](/packages/worksome-exchange)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[tarfin-labs/event-machine

Event-driven state machines for Laravel with event sourcing, type-safe context, and full audit trail.

199.4k](/packages/tarfin-labs-event-machine)[tapp/filament-form-builder

User facing form builder using Filament components

132.4k3](/packages/tapp-filament-form-builder)

PHPackages © 2026

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