PHPackages                             tlucas/liteauth - 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. tlucas/liteauth

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

tlucas/liteauth
===============

v0.1.2(8y ago)175MITPHPPHP ^7.0

Since May 3Pushed 4y ago1 watchersCompare

[ Source](https://github.com/tjwlucas/phpliteauth)[ Packagist](https://packagist.org/packages/tlucas/liteauth)[ RSS](/packages/tlucas-liteauth/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

phpliteauth
===========

[](#phpliteauth)

Small authentication library for PHP, using SQLite as a database backend

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

[](#installation)

```
composer require tlucas/liteauth

```

In the project file (e.g. project.php) you wish to use it in make sure you have

```
require_once('vendor/autoload.php');

```

Then initialise the authentication object with:

```
$auth = new liteAuth\liteAuth('path/to/my/auth_database.db');

```

(Of course, you can call the object anything, but for the rest of this readme, we will assume you called it `$auth`)

Basic usage
-----------

[](#basic-usage)

### User creation

[](#user-creation)

The very first thing you will have to do, before logging in to liteAuth, is, of course, create a user.

This is done using:

```
$auth->newUser($user, $pass, $email, $fname, $sname, $admin);

```

Only the `$user` and `$pass` parameters are required, the rest are optional.

So, to give an example:

```
$auth->newUser('John', 'superstrongpassword');

```

We now have a user called `John` in the database, with the password `superstrongpassword`.

(If newUser() is successful it returns the new user's `id` , otherwise, it returns `False`)

(The other fields should be self-explanatory, with the posssible expception of the `$admin`. This is simply a `True`/`False` field, it has no special meaning within liteAuth, so you are free to use it however you will!)

#### From a form

[](#from-a-form)

There is also included a helper method `registerFromPost()`, to allow for easy registration form creation.

Place it at the target of a form, and it will look for the relevant post variables, to register a new user.

For example, you might have a file `register.php` containing

```
$auth->registerFromPost();

```

And another file `signup.html`:

```

 Admin?

```

The `register.php` will take the data from `signup.html` and create a new user corresponding to the input.

***BE CAREFUL***: Anyone with access to the script calling `registerFromPost()` will be able to create a new user. Make sure this is only accessible by people who should have this authority!

One example would be to require an admin user to be logged in:

`register.php`:

```
if($auth->user->admin)
	$auth->registerFromPost();

```

### Logging in

[](#logging-in)

Logging in is very similar to creating a user, you have the `login()` method you can call:

```
$auth->login($user, $pass);

```

After which, if the password correctly matches the user, it will return `True` and populate `$auth->user`

The following properties are available on the user object, once logged in:

```
$auth->user->user 		// User's username
$auth->user->first_name 	// User's first name, if set
$auth->user->surname 		// User's surname, if set
$auth->user->email		// User's email address, if set
$auth->user->admin		// If the user is set as an admin

```

There is also the special method

```
$auth->name()

```

Which returns either the user's human name (ie. 'Firstname surname' or 'Firstname'), or falls back to username.

### From a form

[](#from-a-form-1)

Just like with registration, there is a helper method for logging in from a form:

```
$auth->loginFromPost();

```

If you put that in, for example, `login.php`, the form at `loginform.html`:

```

```

Will pass the appropriate values to sign in.

Modifying a user
----------------

[](#modifying-a-user)

To modify an existing user, you can edit any of the accessible properties, listed above, for example

```
$auth->user->first_name = 'Stephen';

```

And then call

```
$auth->user->save();

```

And it will update the current user's first name to `Stephen` in the database.

Other methods
-------------

[](#other-methods)

```
$auth->countUsers();

```

Returns a count of users that exist in the database

```
$auth->existUsers();

```

Returns False if no users exist (This is useful to allow for 'first run' setup procedures)

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95.5% 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 ~127 days

Total

3

Last Release

3093d ago

### Community

Maintainers

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

---

Top Contributors

[![tjwlucas](https://avatars.githubusercontent.com/u/20072739?v=4)](https://github.com/tjwlucas "tjwlucas (42 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![persianphilosopher](https://avatars.githubusercontent.com/u/11945003?v=4)](https://github.com/persianphilosopher "persianphilosopher (1 commits)")

### Embed Badge

![Health badge](/badges/tlucas-liteauth/health.svg)

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

###  Alternatives

[kartik-v/yii2-password

Useful password strength validation utilities for Yii Framework 2.0

761.3M17](/packages/kartik-v-yii2-password)[vitalybaev/laravel5-dkim

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

3163.1k](/packages/vitalybaev-laravel5-dkim)

PHPackages © 2026

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