PHPackages                             sharadkashyap/php-api-authentication-debugger - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. sharadkashyap/php-api-authentication-debugger

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

sharadkashyap/php-api-authentication-debugger
=============================================

A framework-independent PHP tool for diagnosing API authentication failures.

v0.1.1(1mo ago)04↓66.7%MITPHPPHP ^8.2CI passing

Since Jul 18Pushed 1mo agoCompare

[ Source](https://github.com/sharadkashyapdev/php-api-authentication-debugger)[ Packagist](https://packagist.org/packages/sharadkashyap/php-api-authentication-debugger)[ RSS](/packages/sharadkashyap-php-api-authentication-debugger/feed)WikiDiscussions main Synced 2w ago

READMEChangelogDependencies (3)Versions (3)Used By (0)

PHP API Authentication Debugger
===============================

[](#php-api-authentication-debugger)

A framework-independent PHP CLI tool that turns API authentication failures into clear findings and safe, actionable recommendations.

It helps diagnose common `401 Unauthorized` and `403 Forbidden` responses without exposing credentials in diagnostic output.

Client presentation
-------------------

[](#client-presentation)

[View client presentation (PDF)](docs/presentation/PHP_API_Authentication_Debugger_Portfolio_Deck.pdf) | [Download editable PowerPoint](docs/presentation/PHP_API_Authentication_Debugger_Portfolio_Deck.pptx)

What it diagnoses
-----------------

[](#what-it-diagnoses)

- Missing, empty, malformed, expired, or revoked Bearer tokens
- Missing or invalid API keys
- Basic authentication formatting and credential issues
- Custom authentication-header problems
- Conflicting authentication mechanisms in one request
- HTTP `401` and `403` failures
- Common permission, scope, role, network, and policy causes

Security first
--------------

[](#security-first)

Credentials are sanitized before they appear in diagnostic results. Use only fake, redacted, or safely sourced values when running diagnostics. Never commit real tokens, API keys, passwords, or production request captures.

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

[](#requirements)

- PHP 8.2 or later
- Composer

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

[](#installation)

```
composer install
```

Quick start
-----------

[](#quick-start)

Diagnose a `401` response where no credentials were attached:

```
php bin/api-auth-debug --url=https://api.example.test/v1/profile --status=401
```

Example output:

```
{
    "authentication_type": "none",
    "http_status_code": 401,
    "successful": false,
    "findings": [
        "The server returned HTTP 401 and no authentication credentials were found in the request."
    ],
    "recommendations": [
        "Attach the credential using the authentication scheme and request location required by the API."
    ]
}
```

Usage
-----

[](#usage)

```
php bin/api-auth-debug --url= [options]

```

OptionDescription`--method=`HTTP method; defaults to `GET``--status=`HTTP response status code`--header="Name: Value"`Request header; may be repeated`--help`Show usage information### Bearer token example

[](#bearer-token-example)

```
php bin/api-auth-debug --url=https://api.example.test/v1/profile --status=401 --header="Authorization: Bearer example-token"
```

### API-key example

[](#api-key-example)

```
php bin/api-auth-debug --url=https://api.example.test/v1/orders --status=403 --header="X-API-Key: example-key"
```

The output is JSON, making it suitable for local troubleshooting, scripts, CI logs, or a future web interface.

Exit codes
----------

[](#exit-codes)

CodeMeaning`0`The request has no diagnostic failure`1`Invalid command input or an application error`2`A diagnostic failure was foundDevelopment checks
------------------

[](#development-checks)

```
./vendor/bin/phpunit
./vendor/bin/phpstan analyse
./vendor/bin/php-cs-fixer fix --dry-run
```

Project status
--------------

[](#project-status)

The core diagnostic engine and CLI are complete. Current work focuses on documentation, CI automation, and portfolio-ready release polish.

License
-------

[](#license)

This project is licensed under the MIT License.

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance90

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

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

45d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fbbf209fc3c79611d3b912b4a4683694601c4d173d07386f3101e376e77547d7?d=identicon)[sharadkashyapdev](/maintainers/sharadkashyapdev)

---

Tags

phpapiAuthenticationdebuggerapi-key403bearer token401

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/sharadkashyap-php-api-authentication-debugger/health.svg)

```
[![Health](https://phpackages.com/badges/sharadkashyap-php-api-authentication-debugger/health.svg)](https://phpackages.com/packages/sharadkashyap-php-api-authentication-debugger)
```

###  Alternatives

[ejarnutowski/laravel-api-key

Authorize requests to your Laravel application with API keys

157480.9k1](/packages/ejarnutowski-laravel-api-key)[andalisolutions/oauth2-anaf

Anaf OAuth 2.0 support for the PHP League's OAuth 2.0 Client

197.3k](/packages/andalisolutions-oauth2-anaf)

PHPackages © 2026

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