PHPackages                             coolcode/authapi - 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. coolcode/authapi

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

coolcode/authapi
================

api authentication using sanctum

v1.0.0(1y ago)02MITPHP

Since Sep 18Pushed 1y ago1 watchersCompare

[ Source](https://github.com/kasunSujeewa/laravel-sanctum-api-auth)[ Packagist](https://packagist.org/packages/coolcode/authapi)[ RSS](/packages/coolcode-authapi/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

coolcode/authapi
================

[](#coolcodeauthapi)

`coolcode/authapi` is a Laravel package that simplifies API authentication using Laravel Sanctum. This package provides a set of endpoints for user registration, login, and logout functionality with token-based authentication.

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

[](#installation)

1. Install the package via Composer:

    ```
    composer require coolcode/authapi
    ```
2. Publish the Sanctum migrations:

    ```
    php artisan vendor:publish --tag=sanctum-migrations
    ```
3. Run the migrations:

    ```
    php artisan migrate
    ```
4. Finally, issue your Laravel Sanctum tokens when users authenticate with your API.

API Endpoints
-------------

[](#api-endpoints)

### 1. Register

[](#1-register)

**Endpoint:** `/api/register`
**Method:** `POST`
**Headers:**

- `Accept: application/json`
- `Content-Type: application/json`

**Request Body (form-data):**

KeyValueTypenametesttextemailtextpasswordpasswordtextconfirm\_passwordpasswordtext**Description:**
Registers a new user in the system.

### 2. Login

[](#2-login)

**Endpoint:** `/api/login`
**Method:** `POST`
**Headers:**

- `Accept: application/json`
- `Content-Type: application/json`

**Request Body (form-data):**

KeyValueTypeemailtextpasswordpasswordtext**Description:**
Authenticates the user and issues a Bearer token for future API requests. The token is stored in the environment variable `token`.

### 3. Logout

[](#3-logout)

**Endpoint:** `/api/logout`
**Method:** `POST`
**Headers:**

- `Accept: application/json`
- `Content-Type: application/json`
- `Authorization: Bearer {{token}}`

**Description:**
Logs the authenticated user out and invalidates the Bearer token.

Usage
-----

[](#usage)

Once you've installed the package and set it up, you can use these endpoints in your Postman collection or any API client to handle user authentication.

### Postman Example

[](#postman-example)

1. Register a user using the **Register** API.
2. Login using the **Login** API to get the Bearer token.
3. Set the token in your environment variables for future authenticated requests.
4. Logout the user using the **Logout** API.

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE.md).

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

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

Unknown

Total

1

Last Release

608d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4469460c7c855db5089a1876693412dca4b1bc2babddce9464ff1cb2d677dbe8?d=identicon)[kasunRanasinghe](/maintainers/kasunRanasinghe)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/coolcode-authapi/health.svg)

```
[![Health](https://phpackages.com/badges/coolcode-authapi/health.svg)](https://phpackages.com/packages/coolcode-authapi)
```

###  Alternatives

[tuandm/laravue

A beautiful dashboard for Laravel built by VueJS

2.2k16.6k](/packages/tuandm-laravue)[hasinhayder/tyro

Tyro - The ultimate Authentication, Authorization, and Role &amp; Privilege Management solution for Laravel 12 &amp; 13

6712.1k2](/packages/hasinhayder-tyro)[ikechukwukalu/requirepin

A laravel package for pin confirmation and validation before processing requests to a specified route

24910.5k1](/packages/ikechukwukalu-requirepin)[daniel-de-wit/lighthouse-sanctum

Laravel Sanctum support for Laravel Lighthouse.

61115.9k](/packages/daniel-de-wit-lighthouse-sanctum)[mohamedgaber-intake40/sanctum-refresh-token

add refresh token feature to laravel sanctum official package

4573.9k](/packages/mohamedgaber-intake40-sanctum-refresh-token)[devtical/filament-sanctum

Laravel Sanctum integration for Filament 4

533.0k](/packages/devtical-filament-sanctum)

PHPackages © 2026

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