PHPackages                             bap/connect - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. bap/connect

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

bap/connect
===========

Connect BAP Platform for laravel 5.\*

v1.0.7(9y ago)0613MITPHPPHP &gt;= 5.4.0

Since Oct 27Pushed 9y ago1 watchersCompare

[ Source](https://github.com/nguyenphuocnhatthanh/BAP_CONNECT)[ Packagist](https://packagist.org/packages/bap/connect)[ RSS](/packages/bap-connect/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (9)Used By (0)

\#Connect Platform for BAP Service

### Install

[](#install)

Add the following line to composer.json file and run `composer update`

```
{
      "require": {
        "bap/connect": "1.*"
      }
}
```

Or install with CLI:

```
    composer require bap/connect

```

Open up `config/app.php` and add the following to the `provires` key.

```
    Bap\ConnectPlatform\ConnectPlatformServiceProvide::class

```

You can register the ConnectPlatform Facade `aliases` key with:

```
     'ConnectPlatform'  => Bap\ConnectPlatform\ConnectPlatformFacade::class

```

Configuration
=============

[](#configuration)

You'll need to publish all vendor assets:

```
    php artisan vendor:publish --provider="Bap\ConnectPlatform\ConnectPlatformServiceProvide"

```

And also run migrations

```
    php artisan migrate

```

And add `PLATFORM_URL` to `.env`

```
    PLATFORM_URL=my_url
    PLATFORM_GRANT=grant
    PLATFORM_CLIENT_ID=CLIENT_ID
    PLATFORM_CLIENT_SECRET=CLIENT_SECRET
    PLATFORM_SCOPE=SCOPE

```

#### Add relation devices and contract

[](#add-relation-devices-and-contract)

```
...
use Bap\ConnectPlatform\Traits\WithDevices;
use Bap\ConnectPlatform\Contracts\WithDevicesInterface;

class User extends Model implements AuthenticatableContract,
                                    AuthorizableContract,
                                    CanResetPasswordContract,
                                    WithDevicesInterface
{
    use Authenticatable,
        Authorizable,
        CanResetPassword,
        RelationDevices;
```

Usage
=====

[](#usage)

- Add middleware jwt auth in `construsctor` method Controller:

```
    public function __constructor()
    {
        $this->middleware('jwt.auth');
    }
```

- Or app/Http/routes.php

```
    Route::post('me', ['before' => 'jwt-auth', function() {
        // Todo
    }]);
```

- Add `device` to options claims for jwt

Profile
-------

[](#profile)

### Get profile

[](#get-profile)

Get user profile from Platform with options `$attributes = ['id', 'username', 'telephone']`

```
