PHPackages                             secretwebmaster/wncms-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. secretwebmaster/wncms-api

ActiveLibrary

secretwebmaster/wncms-api
=========================

WNCMS API management and usage logging package

v1.0.1(5mo ago)01↓100%MITPHP

Since Nov 17Pushed 5mo agoCompare

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

READMEChangelogDependenciesVersions (3)Used By (0)

WNCMS API
=========

[](#wncms-api)

Extend the function of core WNCMS API. Allow multiple API token per user.

This package does not replace the core WNCMS API.
Instead, it adds extra features on top of the existing API layer, mainly focused on token management and usage logging.

---

Features
--------

[](#features)

- Multiple API tokens per user
- Backend UI to create, edit, test, and revoke tokens
- Per-token name, remark, and expiration support (depending on your implementation)
- API token validation middleware (`ValidateApiToken`)
- API usage logging to a dedicated table
- Async logging via `LogApiUsageJob`
- Backend API logs index with filters and pagination
- Dashboard widget to display recent API usage

---

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

[](#requirements)

- WNCMS core installed and working
- Laravel version compatible with your WNCMS core (for example Laravel 11)
- Queue worker configured if you want to process `LogApiUsageJob` asynchronously

---

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

[](#installation)

Install via Composer:

```
composer require secretwebmaster/wncms-api
```

In WNCMS, go to the backend package / module management and **activate** the `wncms-api` package. Migrations and basic setup will be handled by WNCMS according to your core design.

---

Configuration
-------------

[](#configuration)

The package uses `config/wncms-api.php`.

Typical options include:

- Global enable/disable of extended API features
- Whether to log all requests using `ValidateApiToken`
- Default log retention / cleanup strategy (if implemented)

You can adjust these options in your main project `config/wncms-api.php` as needed.

---

Usage
-----

[](#usage)

### 1. Multiple tokens per user

[](#1-multiple-tokens-per-user)

Go to:

```
Backend => API Tokens

```

From there you can:

- Create tokens for any user
- Set token name, remark, and optional expiration
- Copy token value for client usage
- Revoke tokens when no longer needed

Each user can hold multiple active tokens at the same time.

### 2. Protect routes with API token middleware

[](#2-protect-routes-with-api-token-middleware)

In your main application, you can attach the middleware to routes or groups (if not already done by WNCMS core):

```
Route::middleware(['api', 'wncms.api_token'])->group(function () {
    // Your protected API routes
});
```

`ValidateApiToken` will:

- Read token from `Authorization: Bearer {token}` or other sources you defined
- Validate against `api_tokens` table
- Optionally dispatch `LogApiUsageJob` to store logs

### 3. API usage logs

[](#3-api-usage-logs)

Go to:

```
Backend => API Logs

```

You can:

- View requests using each token
- Filter by user, token, method, or path (depending on implementation)
- Use this for debugging and basic security auditing

### 4. Dashboard widget

[](#4-dashboard-widget)

After installing and activating this package, the backend dashboard may show a widget named like:

> API Usage

It can display:

- Recent request count
- Simple charts or stats (depending on your Blade implementation)

---

Development notes
-----------------

[](#development-notes)

This package is designed only to **extend** the existing WNCMS core API layer:

- Core API controllers and routes remain inside `wncms-core`
- `wncms-api` focuses on:

    - token management UI
    - middleware-level token validation
    - usage logging
    - dashboard / reports

You can safely customize views and translations in your project if you need a different UI or language.

---

License
-------

[](#license)

This package follows the same license as the main WNCMS project (for example, MIT), unless specified otherwise in the repository.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance74

Regular maintenance activity

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity36

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.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

172d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4d0914c464f41d278242ffc0dfe3f4fc3345e57ca0a6c34747f6dd702e7961f3?d=identicon)[secretwebmaster](/maintainers/secretwebmaster)

---

Top Contributors

[![secretwebmaster](https://avatars.githubusercontent.com/u/16463637?v=4)](https://github.com/secretwebmaster "secretwebmaster (2 commits)")

### Embed Badge

![Health badge](/badges/secretwebmaster-wncms-api/health.svg)

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

PHPackages © 2026

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