PHPackages                             loadsys/cakephp-auth-userentity - 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. loadsys/cakephp-auth-userentity

ActiveCakephp-plugin[Authentication &amp; Authorization](/categories/authentication)

loadsys/cakephp-auth-userentity
===============================

A CakePHP 3 plugin that enhances Cake's stock AuthComponent to provide a userEntity() method.

1.0.1(10y ago)39.9kMITPHPPHP &gt;=5.6

Since Dec 7Pushed 10y ago10 watchersCompare

[ Source](https://github.com/loadsys/CakePHP-Auth-UserEntity)[ Packagist](https://packagist.org/packages/loadsys/cakephp-auth-userentity)[ Docs](https://github.com/loadsys/CakePHP-Auth-UserEntity)[ RSS](/packages/loadsys-cakephp-auth-userentity/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (5)Versions (3)Used By (0)

CakePHP-Auth-UserEntity
=======================

[](#cakephp-auth-userentity)

[![Latest Version](https://camo.githubusercontent.com/d8c8fcc518e9f0e59cc505a5015f1bbcf548ae120ccbd93c4beb44342dfd65b6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6c6f61647379732f43616b655048502d417574682d55736572456e746974792e7376673f7374796c653d666c61742d737175617265)](https://github.com/loadsys/CakePHP-Auth-UserEntity/releases)[![Build Status](https://camo.githubusercontent.com/3603bf965140e97340ab5a22a125137ef1adaa4c173b1b5584a45d1ed4963989/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6c6f61647379732f43616b655048502d417574682d55736572456e746974792f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/loadsys/CakePHP-Auth-UserEntity)[![Coverage Status](https://camo.githubusercontent.com/d1361df339b77d1b7cf4f065f3a73e629ddfd0642f547f2dd3775c7981cf5775/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f6c6f61647379732f43616b655048502d417574682d55736572456e746974792f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://coveralls.io/r/loadsys/CakePHP-Auth-UserEntity)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/6e1f9ff91c4dab92772b5a8dc0cdfdc3251cf25d9fbd0c40a98b887e2df2aa4a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c6f61647379732f63616b657068702d617574682d75736572656e746974792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/loadsys/cakephp-auth-userentity)

A CakePHP 3 plugin that enhances Cake's stock AuthComponent to provide a userEntity() method.

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

[](#requirements)

- CakePHP 3.0.0+
- PHP 5.6+

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

[](#installation)

Pull the plugin into your project using composer:

```
$ composer require loadsys/cakephp-auth-userentity:~1.0
```

To use this plugin in your app, you must override the stock AuthComponent with the one from this plugin. This is typically done in `AppController::initialize()`:

```
$this->loadComponent('Auth', [
	/**
	 * Name the plugin's Component as the class to use. This is **required**
	 * in order to use the plugin.
	 */
	'className' => 'AuthUserEntity.UserEntityAuth',

	/**
	 * Name the Entity class that will be used as the container for the
	 * array data in Auth->user(). Defaults to `\Cake\ORM\Entity`, which
	 * is safe for all apps, but will exclude any custom logic you may
	 * have defined in your app's "user" Entity class.
	 */
	'entityClass' => '\App\Model\Entity\User',

	/**
	 * Any options to pass to the new Entity when it is created. The defaults
	 * are:
	 *
	 *   [
	 *       'markClean' => true,    // Force the Entity to appear clean.
	 *       'source' => 'AuthUser', // The repository this record originated from.
	 *                               // We default to a fake name to make it clear
	 *                               // the Entity doesn't represent a "true" ORM
	 *                               // record.
	 *   ]
	 */
	'entityOptions' => [
		'associated' => ['Permissions', 'Groups'],
	],

	/**
	 * (The rest of your normal Auth configs follow here.)
	 */
	// ...
]);
```

Usage
-----

[](#usage)

Once installed, you will be able to retrieve a User entity from your controllers like so:

```
	// Get the whole entity:
	$user = $this->Auth->userEntity();

	// Or to get a specific property (which will engage any
	// _getProperty() methods you have defined in your Entity class):
	$userEmail = $this->Auth->userEntity('email');

	// Internally, the Entity::get() interface is used, so you can pass
	// nested keys (but remember that this data must be loaded into the
	// Auth session data!):
	$groupName = $this->Auth->userEntity('group.name');

	// Or to call a function from your entity:
	if (!$this->Auth->userEntity()->isAdmin()) {
		$this->Flash->error('Only admins can use this method.');
		return $this->redirect('/');
	}
```

Like the stock AuthComponent's `::user()` method, `null` will be returned whenever there is no authenticated User data available in the Session. It's also important to remember that **only** the data that is saved into the Auth session will be available in the Entity, but you can use [lazy loading in the Entity class](http://book.cakephp.org/3.0/en/orm/entities.html#lazy-loading-associations) to fetch additional properties as needed or [adjust the find query](http://book.cakephp.org/3.0/en/controllers/components/authentication.html#customizing-find-query) used to authenticate users so associated data is available in the Auth session.

Also keep in mind that currently **only** the top-level data is [marshaled](http://book.cakephp.org/3.0/en/orm/saving-data.html#converting-request-data-into-entities), so sub-properties will exist only as arrays and not Entities themselves.

Contributing
------------

[](#contributing)

### Reporting Issues

[](#reporting-issues)

Please use [GitHub Isuses](https://github.com/loadsys/CakePHP-Auth-UserEntity/issues) for listing any known defects or issues.

### Development

[](#development)

When developing this plugin, please fork and issue a PR for any new development.

License
-------

[](#license)

[MIT](https://github.com/loadsys/CakePHP-Auth-UserEntity/blob/master/LICENSE.md)

Copyright
---------

[](#copyright)

[Loadsys Web Strategies](http://www.loadsys.com) 2015

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity59

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

Every ~0 days

Total

2

Last Release

3860d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/58c6913a72757502a801ebc71f995eb1c4f7a53a7de7314a20b9a1f1d6131b60?d=identicon)[jtyost2](/maintainers/jtyost2)

![](https://www.gravatar.com/avatar/2380c6ad9546e6c8ce5c5b641f5a4bce0c4d3e7f3a377dc287936dff50cc3064?d=identicon)[ricog](/maintainers/ricog)

---

Top Contributors

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

---

Tags

authcakephpuserentitycomponent

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/loadsys-cakephp-auth-userentity/health.svg)

```
[![Health](https://phpackages.com/badges/loadsys-cakephp-auth-userentity/health.svg)](https://phpackages.com/packages/loadsys-cakephp-auth-userentity)
```

###  Alternatives

[cakedc/users

Users Plugin for CakePHP

525928.0k20](/packages/cakedc-users)[dereuromark/cakephp-tinyauth

A CakePHP plugin to handle user authentication and authorization the easy way.

131240.2k13](/packages/dereuromark-cakephp-tinyauth)[helsingborg-stad/municipio

A bootstrap theme for creating municipality sites.

4028.5k10](/packages/helsingborg-stad-municipio)[rainlab/user-plugin

User plugin for October CMS

11955.0k15](/packages/rainlab-user-plugin)[uzyn/cakephp-opauth

Opauth plugin for CakePHP v2.x, allowing simple plug-n-play 3rd-party authentication with CakePHP

130277.1k](/packages/uzyn-cakephp-opauth)[webtechnick/cakephp-facebook-plugin

CakePHP Facebook Plugin

43612.3k](/packages/webtechnick-cakephp-facebook-plugin)

PHPackages © 2026

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