PHPackages                             codersvn/usermanagement - 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. codersvn/usermanagement

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

codersvn/usermanagement
=======================

User component for Laravel / Lumen

v1.3.8(7y ago)0189PHP

Since Aug 6Pushed 7y ago3 watchersCompare

[ Source](https://github.com/codersvn/usermanagement)[ Packagist](https://packagist.org/packages/codersvn/usermanagement)[ RSS](/packages/codersvn-usermanagement/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (4)Versions (17)Used By (0)

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

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

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

Table of content
----------------

[](#table-of-content)

- [User Component for Laravel and Lumen](#user-component-for-laravel-and-lumen)
    - [Table of content](#table-of-content)
    - [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)
    - [Additional Configuration](#additional-configuration)

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

[](#installation)

### Composer

[](#composer)

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

```
composer require codersvn/usermanagement

```

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' => [
    ...
    Dingo\Api\Provider\LaravelServiceProvider::class,
    Tymon\JWTAuth\Providers\LaravelServiceProvider::class,
    Prettus\Repository\Providers\RepositoryServiceProvider::class,
    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.

```
