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

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

spandansingh/auth-server-api
============================

Auth Server API for PHP

1823PHP

Since May 26Pushed 11y ago1 watchersCompare

[ Source](https://github.com/spandansingh/auth-server-api)[ Packagist](https://packagist.org/packages/spandansingh/auth-server-api)[ RSS](/packages/spandansingh-auth-server-api/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (2)Used By (0)

Auth Server API
===============

[](#auth-server-api)

[![Build Status](https://camo.githubusercontent.com/9cd75ca836997ee702996006fd87be2df423d1cf6853ee7aa7b83c036050b38d/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f67757a7a6c652f67757a7a6c652e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/guzzle/guzzle)

Auth Server API is a PHP HTTP client for Auth Server that makes it easy to send HTTP requests and trivial to integrate with web services.

- Manages things like persistent connections, simplifies sending streaming POST requests with fields ,and abstracts away the underlying HTTP transport layer.
- Set the cookie on your server by the token issued by the Auth Server
- Easy login and logout function
- Auth Server API makes it so that you no longer need to fool around with cURL options, stream contexts, or sockets for connecting with Auth Server.

### Usage

[](#usage)

```
$auth = new Auth\ApiClient(array(
	'KEY' =>  AUTH_KEY,  // YOUR AUTH KEY
	'SECRET' =>  AUTH_SECRET,  // YOUR AUTH SECRET
	'LOGIN_URI' =>   '/login.php', // YOUR APP LOGIN URL
));
```

### For Check Login Status

[](#for-check-login-status)

- If the user is logged in, it returns the user information array.
- If it is not logged in, it redirects to the auth server login page

```
$token = isset($_SESSION[‘auth_server_token’])?$_SESSION[‘auth_server_token’]:NULL ;  // If you save token in session than you can receive it like this .

if($user = $auth -> isloggedIn($token)){
        echo ‘welcome’.$user[‘first_name’].’’.$user[‘last_name’];
 }
```

### For Login

[](#for-login)

```
$response = $auth -> dologin();
$token = $auth -> getToken();
$_SESSION[‘auth_server_token’] = $token;
header(‘location:’ , $auth ->getcallbackUri());  // After Saving token redirect to the callback_url()
session_write_close();
.
```

### For Logout

[](#for-logout)

```
unset($_SESSION['auth_server_token']);
$auth->doLogout();
```

### Installing via Composer

[](#installing-via-composer)

The recommended way to install Auth Server API is through [Composer](http://getcomposer.org).

```
# Install Composer
curl -sS https://getcomposer.org/installer | php
```

Next, run the Composer command to install the latest stable version of Auth Server API:

```
composer require spandansingh/auth-server-api:dev-master
```

After installing, you need to require Composer's autoloader:

```
require 'vendor/autoload.php';
```

Sample app
----------

[](#sample-app)

Check out [Auth Server Demo App](https://github.com/spandansingh/auth-server-demo-app) for a quick sample app.

Consultation
------------

[](#consultation)

- Spandan Singh
- Looking for PHP web development solutions or consultation? [Drop me a mail](mailto:developer.spandan@gmail.com).

###  Health Score

23

—

LowBetter than 25% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity43

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6729019?v=4)[Spandan Singh](/maintainers/spandansingh)[@spandansingh](https://github.com/spandansingh)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/spandansingh-auth-server-api/health.svg)

```
[![Health](https://phpackages.com/badges/spandansingh-auth-server-api/health.svg)](https://phpackages.com/packages/spandansingh-auth-server-api)
```

###  Alternatives

[tg/tgwebvalid

An easy way to validate Telegram Login Widget and Telegram Mini App users on your website using PHP

6827.5k1](/packages/tg-tgwebvalid)[vitalybaev/laravel5-dkim

Laravel 5/6 package for signing outgoing messages with DKIM.

3163.1k](/packages/vitalybaev-laravel5-dkim)[kissdigital-com/apple-sign-in-client-secret-generator

PHP package for generating 'client secret' for Sign In with Apple

2125.5k](/packages/kissdigital-com-apple-sign-in-client-secret-generator)[denniseilander/laravel-passport-scopes-restriction

Restrict scopes for different Laravel Passport clients.

1636.3k](/packages/denniseilander-laravel-passport-scopes-restriction)

PHPackages © 2026

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