PHPackages                             quangvule/phalcon-user-plugin - 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. quangvule/phalcon-user-plugin

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

quangvule/phalcon-user-plugin
=============================

User plugin for Phalcon PHP framework

3.0.11(9y ago)018MITPHPPHP &gt;=5.3.2

Since Jun 13Pushed 6y ago1 watchersCompare

[ Source](https://github.com/quangvule/PhalconUserPlugin)[ Packagist](https://packagist.org/packages/quangvule/phalcon-user-plugin)[ Docs](https://github.com/calinrada/PhalconUserPlugin)[ RSS](/packages/quangvule-phalcon-user-plugin/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (8)Versions (32)Used By (0)

Phalcon User Plugin (v 3.0)
===========================

[](#phalcon-user-plugin-v-30)

- [About](#about)
- [Features](#features)
- [Installation](#installation)
- [Plug it](#plug-it)
- [Configuration](#configuration)
- [Example controller](#example-controller)
- [Known issues](#known-issues)
- [Examples](#examples)
- [TODO](#todo)

### About

[](#about)

This is a plugin based on Vokuro ACL idea.

### Features

[](#features)

- Login / Register with Facebook account
- Login / Register with LinkedIn account
- Login / Register with Twitter account
- Login / Register with Google account
- Change password
- Password recovery by email
- Protect different areas from your website, where a user must be logged in, in order to have access
- Protect different actions, based on the ACL list for each user
- User profile: birth date, birth location, current location, profile picture
- Locations - save locations using google API - see Wiki for examples
- Simple notifications system

### Installation

[](#installation)

The recommended installation is via Composer. Just add the following line to your `composer.json`:

```
{
    "require": {
        "crada/phalcon-user-plugin": "^3.0"
    }
}
```

```
$ php composer.phar update
```

OR simply execute

```
$ composer require crada/phalcon-user-plugin:^3.0
```

### Plug it

[](#plug-it)

Add the following lines where to your events manager:

```
$security = new \Phalcon\UserPlugin\Plugin\Security($di);
$eventsManager->attach('dispatch', $security);
```

Full example code:

```
use Phalcon\UserPlugin\Plugin\Security as SecurityPlugin;
use Phalcon\Mvc\Dispatcher;

$di->setShared(
    'dispatcher',
    function() use ($di) {
        $eventsManager = $di->getShared('eventsManager');

        $security = new SecurityPlugin($di);
        $eventsManager->attach('dispatch', $security);

        $dispatcher = new Dispatcher();
        $dispatcher->setEventsManager($eventsManager);

        return $dispatcher;
    }
);
```

Register Auth, Mail and Acl services

```
use Phalcon\UserPlugin\Auth\Auth;
use Phalcon\UserPlugin\Acl\Acl;
use Phalcon\UserPlugin\Mail\Mail;

$di->setShared(
    'auth',
    function() {
        return new Auth();
    }
);

$di->setShared(
    'acl',
    function() {
        return new Acl();
    }
);

$di->setShared(
    'mail',
    function() {
        return new Mail();
    }
);
```

### Configuration

[](#configuration)

You must add configuration keys to your config.php file. If you are using a multimodule application, i recommend you to set up the configuration separately for each module.

#### Configuration examples

[](#configuration-examples)

In the example bellow, you will treat your website as public, EXCEPT the actions ACCOUNT and PROFILE from the USER controller:

```
'pup' => [
    'redirect' => [
        'success' => 'user/profile',
        'failure' => 'user/login'
    ],
    'resources' => [
        'type' => 'public',
        'resources' => [
            '*' => [
                // All except
                'user' => ['account', 'profile']
            ]
        ]
    ]
];
```

In the example bellow, the ONLY PUBLIC resources are the actions LOGIN and REGISTER from the USER controller:

```
'pup' => [
    'redirect' => [
        'success' => 'user/profile',
        'failure' => 'user/login'
    ],
    'resources' => [
        'type' => 'public',
        'resources' => [
            'user' => [
                'user' => ['login', 'register']
            ]
        ]
    ]
];
```

In the example bellow, you will treat your website as private, EXCEPT the actions LOGIN and REGISTER from the USER controller:

```
'pup' => [
    'redirect' => [
        'success' => 'user/profile',
        'failure' => 'user/login'
    ],
    'resources' => [
        'type' => 'private',
        'resources' => [
            '*' => [
                // All except
                'user' => ['login', 'register']
            ]
        ]
    ]
];
```

In the example bellow, the ONLY PRIVATE resources are the actions ACCOUNT and PROFILE from the USER controller:

```
'pup' => [
    'redirect' => [
        'success' => 'user/profile',
        'failure' => 'user/login'
    ],
    'resources' => [
        'type' => 'private',
        'resources' => [
            'user' => [
                'user' => ['account', 'profile']
            ]
        ]
    ]
];
```

Configuration example with connectors:

```
// phalcon-user-plugin
'pup' => [
    'redirect' => [
        'success' => 'user/profile',
        'failure' => 'user/login'
    ],
    'resources' => [
        'type' => 'public',
        'resources' => [
            '*' => [
                // All except
                'user' => ['account', 'profile']
            ]
        ]
    ],
    'connectors' => [
        'facebook' => [
            'appId' => 'YOUR_FACEBOOK_APP_ID',
            'secret' => 'YOUR_FACEBOOK_APP_SECRET'
        ],
        'linkedIn' => [
            'api_key' => 'YOUR_LINKED_IN_APP_ID',
            'api_secret' => 'YOUR_LINKED_IN_APP_SECRET',
            'callback_url' => 'CALLBACK_URL'
        ],
        'twitter' => [
            'consumer_key' => 'TWITTER_CONSUMER_KEY',
            'consumer_secret' => 'TWITTER_CONSUMER_SECRET',
            // Leave empty if you don't want to set it
            'user_agent' => 'YOUR_APPLICATION_NAME'
        ],
        'google' => [
            'application_name' => 'YOUR_APPLICATION_NAME',
            'client_id' => 'YOUR_CLIENT_ID',
            'client_secret' => 'YOUR_CLIENT_SECRET',
            'developer_key' => 'YOUR_DEVELOPER_KEY',
            'redirect_uri' => 'YOUR_REDIRECT_URI'
        ]
    ]
];
```

### Example controller

[](#example-controller)

- For a complete controller example read the Wiki page:

```
class UserController extends Controller
{
    /**
     * Login user
     * @return \Phalcon\Http\ResponseInterface
     */
    public function loginAction()
    {
        if (true === $this->auth->isUserSignedIn()) {
            $this->response->redirect(['action' => 'profile']);
        }

        $form = new LoginForm();

        try {
            $this->auth->login($form);
        } catch (AuthException $e) {
            $this->flash->error($e->getMessage());
        }

        $this->view->form = $form;
    }

    /**
     * Login with Facebook account
     */
    public function loginWithFacebookAction()
    {
        try {
            $this->view->disable();
            return $this->auth->loginWithFacebook();
        } catch(AuthException $e) {
            $this->flash->error('There was an error connectiong to Facebook.');
        }
    }

    /**
     * Login with LinkedIn account
     */
    public function loginWithLinkedInAction()
    {
        try {
            $this->view->disable();
            $this->auth->loginWithLinkedIn();
        } catch(AuthException $e) {
            $this->flash->error('There was an error connectiong to LinkedIn.');
        }
    }

    /**
     * Login with Twitter account
     */
    public function loginWithTwitterAction()
    {
        try {
            $this->view->disable();
            $this->auth->loginWithTwitter();
        } catch(AuthException $e) {
            $this->flash->error('There was an error connectiong to Twitter.');
        }
    }

    /**
     * Login with Google account
     */
    public function loginWithGoogleAction()
    {
        try {
            $this->view->disable();
            $this->auth->loginWithGoogle();
        } catch(AuthException $e) {
            $this->flash->error('There was an error connectiong to Google.');
        }
    }

    /**
     * Logout user and clear the data from session
     *
     * @return \Phalcon\Http\ResponseInterface
     */
    public function signoutAction()
    {
        $this->auth->remove();
        return $this->response->redirect('/', true);
    }
}
```

### Known issues

[](#known-issues)

- Twitter does not provide us the email. We are generating a random email for the user. It is your choice how you handle this

### Examples

[](#examples)

- [Notifications](https://github.com/calinrada/PhalconUserPlugin/wiki/Notifications)

### TODO

[](#todo)

- Implement CRUD templates for ACl, UserManagement, etc

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 76.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 ~67 days

Recently: every ~244 days

Total

30

Last Release

2402d ago

Major Versions

1.1.13 → 2.02015-03-11

2.0.7 → 3.0.02016-12-06

### Community

Maintainers

![](https://www.gravatar.com/avatar/0c89a98c544fca1cdf7bbefe91803e0d469466d7c43feb59d8063fcc3e11a75e?d=identicon)[quangvule](/maintainers/quangvule)

---

Top Contributors

[![calinrada](https://avatars.githubusercontent.com/u/873482?v=4)](https://github.com/calinrada "calinrada (75 commits)")[![vuxlee584](https://avatars.githubusercontent.com/u/7167251?v=4)](https://github.com/vuxlee584 "vuxlee584 (5 commits)")[![kbsali](https://avatars.githubusercontent.com/u/53676?v=4)](https://github.com/kbsali "kbsali (4 commits)")[![mizterp](https://avatars.githubusercontent.com/u/843041?v=4)](https://github.com/mizterp "mizterp (3 commits)")[![loeken](https://avatars.githubusercontent.com/u/6338814?v=4)](https://github.com/loeken "loeken (2 commits)")[![mzf](https://avatars.githubusercontent.com/u/4039372?v=4)](https://github.com/mzf "mzf (2 commits)")[![oligus](https://avatars.githubusercontent.com/u/2466591?v=4)](https://github.com/oligus "oligus (2 commits)")[![xboston](https://avatars.githubusercontent.com/u/201306?v=4)](https://github.com/xboston "xboston (1 commits)")[![sergeyklay](https://avatars.githubusercontent.com/u/1256298?v=4)](https://github.com/sergeyklay "sergeyklay (1 commits)")[![SidRoberts](https://avatars.githubusercontent.com/u/1364214?v=4)](https://github.com/SidRoberts "SidRoberts (1 commits)")[![sumeko](https://avatars.githubusercontent.com/u/36034171?v=4)](https://github.com/sumeko "sumeko (1 commits)")[![byfareska](https://avatars.githubusercontent.com/u/24964397?v=4)](https://github.com/byfareska "byfareska (1 commits)")

---

Tags

facebookusertwitterloginphalconlinkedingoogle plus

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/quangvule-phalcon-user-plugin/health.svg)

```
[![Health](https://phpackages.com/badges/quangvule-phalcon-user-plugin/health.svg)](https://phpackages.com/packages/quangvule-phalcon-user-plugin)
```

###  Alternatives

[crada/phalcon-user-plugin

User plugin for Phalcon PHP framework

1892.5k1](/packages/crada-phalcon-user-plugin)[hwi/oauth-bundle

Support for authenticating users using both OAuth1.0a and OAuth2 in Symfony.

2.4k21.5M67](/packages/hwi-oauth-bundle)[socialconnect/auth

Social Connect Auth Component

568845.4k5](/packages/socialconnect-auth)[fof/oauth

Allow users to log in with GitHub, Facebook, Google, Discord, GitLab, LinkedIn, and more!

50118.7k41](/packages/fof-oauth)[and/oauth

Simple and amazing OAuth library with many providers. Just try it out!

4645.2k2](/packages/and-oauth)[org_heigl/hybridauth

Lightweight Authentication Module for Zend-Framework 2 using the hybridauth-library

211.9k](/packages/org-heigl-hybridauth)

PHPackages © 2026

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