PHPackages                             zerig/user-manager - 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. zerig/user-manager

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

zerig/user-manager
==================

Manage User class

v1.0.0(6y ago)08MITPHPPHP &gt;=5.6.0

Since Apr 26Pushed 6y ago1 watchersCompare

[ Source](https://github.com/Zerig/user-manager)[ Packagist](https://packagist.org/packages/zerig/user-manager)[ RSS](/packages/zerig-user-manager/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

SSYTEM \\ USER
==============

[](#ssytem--user)

- needs [**\\SqlManager\\Mysql**](https://github.com/Zerig/sql-manager) class works with User account

FIRST YOU NEED
--------------

[](#first-you-need)

```
$GLOBALS["mysql"] = new \SqlManager\Mysql([
	"server_name"	=> "localhost",
	"db_user"	=> "root",
	"db_pass"	=> "",
	"db_name"	=> "test"
]);

$GLOBALS["mysql"]->multi_query("
	CREATE TABLE `user` (
	  `id` int(11) NOT NULL AUTO_INCREMENT,
	  `user_type_id` smallint(2) DEFAULT NULL,
	  `login` varchar(150) COLLATE utf8_czech_ci NOT NULL,
	  `password` varchar(150) COLLATE utf8_czech_ci NOT NULL,
	  PRIMARY KEY (`id`),
	  UNIQUE KEY `login` (`login`),
	  KEY `user_type_id` (`user_type_id`),
	  CONSTRAINT `user_ibfk_2` FOREIGN KEY (`user_type_id`) REFERENCES `user_type` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
	) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;

	INSERT INTO `user` (`id`, `user_type_id`, `login`, `password`) VALUES
	(1,	1,	'zerig',	'$2y$15$"."u55Iz2kebEpW01bMLYYcReBGy5ZHoFvmRQyeaerGp0f8GnMLrbJEq');

	CREATE TABLE `user_type` (
	  `id` smallint(2) NOT NULL AUTO_INCREMENT,
	  `name` varchar(150) COLLATE utf8_czech_ci NOT NULL,
	  PRIMARY KEY (`id`),
	  UNIQUE KEY `name` (`name`)
	) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;

	INSERT INTO `user_type` (`id`, `name`) VALUES
	(2,	'editor'),
	(1,	'admin');
");
```

```
$GLOBALS["user"] = new \UserManager\User();
$GLOBALS["user"]->login("zerig", "123456");

public $id              => 1
public $user_type_id    => 1
public $user_type_name  => "admin"
public $login           => "zerig"

public static $pass_len => 6;	// MIN length of passwords
```

---

login($login, $password)
------------------------

[](#loginlogin-password)

- **$login \[string\]** user name for login
- **$password \[string\]** user password for login

- **@return \[boolean\]** success of action

Log user into system.

```
$GLOBALS["user"]->login("not_exist", "123456") => 0
$GLOBALS["user"]->isLogged() => 0

$GLOBALS["user"]->login("zerig", "123456")     => 1
$GLOBALS["user"]->isLogged() => 1
```

logout()
--------

[](#logout)

- **@return \[boolean\]** success of action

Log user out of system.

```
$GLOBALS["user"]->logout()   => 1
$GLOBALS["user"]->isLogged() => 0
```

::signup($login, $password, $type)
----------------------------------

[](#signuplogin-password-type)

- **$login \[string\]** user name for login
- **$password \[string\]** user password for login
- **$type \[num\]** user\_type\_id

- **@return \[boolean\]** success of action

Add new user into MYSQL. New password length have to be min. 6 chars.

```
\UserManager\User::signup("zerig", "555555", 1) => 0	// user already exist
\UserManager\User::signup("nym", "123", 1)      => 0	// password doesn't have 6 chars

\UserManager\User::signup("nym", "123456", 1)   => 1
$GLOBALS["user"]->login("nym", "123456")    => 1
$GLOBALS["user"]->isLogged() => 1
```

---

::existUser($login)
-------------------

[](#existuserlogin)

- **$login \[string\]** user name

- **@return \[boolean\]** success of action

Add new user into MYSQL. New password length have to be min. 6 chars.

```
\UserManager\User::existUser("not_exist") => 0
\UserManager\User::existUser("nym")       => 1
```

---

changePassword($old\_password, $new\_password, $control\_password = null)
-------------------------------------------------------------------------

[](#changepasswordold_password-new_password-control_password--null)

- **$old\_password \[string\]** origin user password
- **$new\_password \[string\]** new password
- **$constrol\_password \[string\]** controling of the new password - not necessary

- **@return \[boolean\]** success of action

change password to new password

```
$GLOBALS["user"]->changePassword("123456", "666")              => 0	// new password is too short
$GLOBALS["user"]->changePassword("123456", "666666")           => 1
$GLOBALS["user"]->changePassword("666666", "123", "123")       => 0	// new password and confirmation is too short
$GLOBALS["user"]->changePassword("666666", "123456", "123333") => 0	// new password and comfirmation is not the same
```

changeLogin($new\_login, $password)
-----------------------------------

[](#changeloginnew_login-password)

- **$new\_login \[string\]** new login name
- **$password \[string\]** origin user passworf for comfirmation

- **@return \[boolean\]** success of action

change password to new password

```
$GLOBALS["user"]->changeLogin("nym2", "111111") => 0	// wrong password
$GLOBALS["user"]->changeLogin("nym2", "666666") => 1	// right password
```

---

::removeUser($login)
--------------------

[](#removeuserlogin)

- **$login \[string\]** user name login to be deleted

- **@return \[boolean\]** success of action

Delete user from Mysql.

```
\UserManager\User::removeUser("not_exist") => 1	// not existing user
\UserManager\User::removeUser("nym")       => 1	// existing user
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2213d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

useruser manager

### Embed Badge

![Health badge](/badges/zerig-user-manager/health.svg)

```
[![Health](https://phpackages.com/badges/zerig-user-manager/health.svg)](https://phpackages.com/packages/zerig-user-manager)
```

###  Alternatives

[lab404/laravel-impersonate

Laravel Impersonate is a plugin that allows to you to authenticate as your users.

2.3k16.4M48](/packages/lab404-laravel-impersonate)[sonata-project/user-bundle

Symfony SonataUserBundle

3465.6M44](/packages/sonata-project-user-bundle)[2amigos/yii2-usuario

Highly customizable and extensible user management, authentication, and authorization Yii2 extension

298275.5k14](/packages/2amigos-yii2-usuario)[lab404/laravel-auth-checker

Laravel Auth Checker allows you to log users authentication, devices authenticated from and lock intrusions.

223164.9k2](/packages/lab404-laravel-auth-checker)[yajra/laravel-acl

Laravel ACL is a simple role, permission ACL for Laravel Framework.

112103.9k1](/packages/yajra-laravel-acl)[rickycezar/laravel-jwt-impersonate

Laravel Impersonate is a plugin that allows to you to authenticate as your users.

24117.6k](/packages/rickycezar-laravel-jwt-impersonate)

PHPackages © 2026

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