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

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

webpress/user-manager
=====================

User component for Laravel / Lumen

3.1.87(4y ago)12.9k58PHPCI failing

Since Jun 3Pushed 3y ago1 watchersCompare

[ Source](https://github.com/webpress-vn/user-manager)[ Packagist](https://packagist.org/packages/webpress/user-manager)[ RSS](/packages/webpress-user-manager/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (10)Dependencies (7)Versions (143)Used By (8)

User Component for Laravel and Lumen
====================================

[](#user-component-for-laravel-and-lumen)

- [User Component for Laravel and Lumen](#user-component-for-laravel-and-lumen)
- [Installation](#installation)
    - [Composer](#composer)
    - [Service provider](#service-provider)
        - [Laravel](#laravel)
        - [Lumen](#lumen)
    - [Config and Migration](#config-and-migration)
        - [Laravel](#laravel-1)
        - [Lumen](#lumen-1)
    - [Environment](#environment)
- [Configuration](#configuration)
    - [URL Namespace](#url-namespace)
    - [User Model](#user-model)
    - [User Transformer](#user-transformer)
        - [Laravel](#laravel-2)
        - [Lumen](#lumen-2)
    - [Social login](#social-login)
- [User Model](#user-model-1)
    - [User Schema](#user-schema)
    - [User Management](#user-management)
- [APIs List](#apis-list)
- [Routing](#routing)
    - [Custom Routing](#custom-routing)
    - [Custom Controller](#custom-controller)
    - [Events](#events)
    - [Middleware](#middleware)
    - [Additional Configuration](#additional-configuration)
- [Social media login](#social-media-login)
    - [Configuration](#configuration-1)
    - [Use in view](#use-in-view)

The User Component package provides a convenient way of managing application's users.

Installation
============

[](#installation)

Composer
--------

[](#composer)

To include the package in your project, Please run following command.

```
composer require vicoders/usermanager

```

Once the package is installed, the next step is dependant on which framework you are using.

Service provider
----------------

[](#service-provider)

### Laravel

[](#laravel)

In your `config/app.php` add the following Service Providers to the end of the `providers` array:

```
'providers' => [
    ...
    VCComponent\Laravel\User\Providers\UserComponentProvider::class,
    VCComponent\Laravel\User\Providers\UserComponentRouteProvider::class,
    VCComponent\Laravel\User\Providers\UserComponentEventProvider::class,
],
```

### Lumen

[](#lumen)

In your `bootstrap/app.php` add the following Service Providers.

```
$app->register(App\Providers\AuthServiceProvider::class);
$app->register(Tymon\JWTAuth\Providers\LumenServiceProvider::class);
$app->register(Dingo\Api\Provider\LumenServiceProvider::class);
$app->register(Prettus\Repository\Providers\LumenRepositoryServiceProvider::class);
$app->register(VCComponent\Laravel\User\Providers\LumenUserComponentProvider::class);
```

You also need to define `route` in `bootstrapp/app.php`.

```
$app->router->group([
], function ($router) {
    require __DIR__ . '/../vendor/codersvn/usermanagement/src/routes.php';
});
```

Config and Migration
--------------------

[](#config-and-migration)

### Laravel

[](#laravel-1)

Run the following commands to publish configuration and migration files.

```
php artisan vendor:publish --provider="VCComponent\Laravel\User\Providers\UserComponentProvider"
php artisan vendor:publish --provider="Dingo\Api\Provider\LaravelServiceProvider"
php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\LaravelServiceProvider"
php artisan vendor:publish --provider "Prettus\Repository\Providers\RepositoryServiceProvider"

```

Create tables.

```
php artisan migrate

```

> Please delete the Laravel default `users` migration file to avoid conflict when running the migrate command.

Make a change in `config/auth.php`.

```
'providers' => [
    'users' => [
        'driver' => 'eloquent',
        'model'  => VCComponent\Laravel\User\Entities\User::class,
    ],
],
```

### Lumen

[](#lumen-1)

Create `config/auth.php` file and add the following contents.

```
