PHPackages                             lartie/attach-social-account - 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. lartie/attach-social-account

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

lartie/attach-social-account
============================

Пакет для подключения аккаунтов социальный сетей к пользователю для Laravel 5.2

v0.1.1(9y ago)129MITPHP

Since Apr 11Pushed 9y ago2 watchersCompare

[ Source](https://github.com/lartie/AttachSocialAccount)[ Packagist](https://packagist.org/packages/lartie/attach-social-account)[ RSS](/packages/lartie-attach-social-account/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (3)Used By (0)

Attach Social Account For Laravel 5.2
=====================================

[](#attach-social-account-for-laravel-52)

[![Latest Stable Version](https://camo.githubusercontent.com/cdd488afecfed626428b0fe302e410f0f38da760d4c569901af613e8482b1310/68747470733a2f2f706f7365722e707567782e6f72672f6c61727469652f6174746163682d736f6369616c2d6163636f756e742f762f737461626c65)](https://packagist.org/packages/lartie/attach-social-account)[![Total Downloads](https://camo.githubusercontent.com/2bbc02f44158cfb54d3faad56b0c96001413d1a8784fe7d3ffb0a338447559f4/68747470733a2f2f706f7365722e707567782e6f72672f6c61727469652f6174746163682d736f6369616c2d6163636f756e742f646f776e6c6f616473)](https://packagist.org/packages/lartie/attach-social-account)[![Latest Unstable Version](https://camo.githubusercontent.com/c95e4a19e7b8c1857d981db274c0dd0cbbfadc1894ba9f408800e0cd6c232143/68747470733a2f2f706f7365722e707567782e6f72672f6c61727469652f6174746163682d736f6369616c2d6163636f756e742f762f756e737461626c65)](https://packagist.org/packages/lartie/attach-social-account)[![License](https://camo.githubusercontent.com/a4d07d8c7accf265b075fa5e9ce5b15e79f0d60c0fae3d8a48734ed96ce520ce/68747470733a2f2f706f7365722e707567782e6f72672f6c61727469652f6174746163682d736f6369616c2d6163636f756e742f6c6963656e7365)](https://packagist.org/packages/lartie/attach-social-account)[![composer.lock](https://camo.githubusercontent.com/be38bb25c59c1c7647f4906bd142442e9a1cb77d0d1f2b06d937a0b618c895f2/68747470733a2f2f706f7365722e707567782e6f72672f6c61727469652f6174746163682d736f6369616c2d6163636f756e742f636f6d706f7365726c6f636b)](https://packagist.org/packages/lartie/attach-social-account)

- [Installation](#installation)
    - [Composer](#composer)
    - [Service Provider](#service-provider)
    - [Config File And Migrations](#config-file-and-migrations)
    - [HasSocialAccount Trait And Contract](#hassocialaccount-trait-and-contract)
- [Usage](#usage)
    - [Creating Social Network](#creating-social-network)
    - [Attach Social Account](#attach-social-account)
    - [Detach Social Account](#detach-social-account)
    - [Checking](#checking)
    - [Blade Extensions](#blade-extensions)
- [License](#license)

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

[](#installation)

### Composer

[](#composer)

```
composer require lartie/attach-social-account

```

### Service Provider

[](#service-provider)

Add the package to your application service providers in `config/app.php` file.

```
'providers' => [

    /*
     * Application Service Providers..
     */
    App\Providers\AppServiceProvider::class,
    App\Providers\AuthServiceProvider::class,
    App\Providers\EventServiceProvider::class,
    App\Providers\RouteServiceProvider::class,
    ...

    /*
     * Extensions
     */
    LArtie\AttachSocialAccount\ServiceProvider::class,

],
```

### Config File And Migrations

[](#config-file-and-migrations)

Publish the package config file and migrations to your application. Run these commands inside your terminal.

```
php artisan vendor:publish

```

And also run migrations.

```
php artisan migrate

```

> This uses the default users table which is in Laravel. You should already have the migration file for the users table available and migrated.

### HasSocialAccount Trait And Contract

[](#hassocialaccount-trait-and-contract)

Include `HasSocialAccount` trait and also implement `HasSocialAccount` contract inside your `User` model.

```
use LArtie\AttachSocialAccount\Core\Traits\HasSocialAccount;
use LArtie\AttachSocialAccount\Core\Contracts\HasSocialAccount as HasSocialAccountContract;

class User extends Authenticatable implements HasSocialAccountContract
{
    use HasSocialAccount;
```

And that's it!

Usage
-----

[](#usage)

```
 $user = User::first();

 $vkData = [
     'token' => 'token',
     'uid' => 'user_id',
     'nickname' => 'username',
     'name' => 'first name and last name',
     'email' => 'example@gmail.com',
     'avatar' => 'link_to',
 ];
```

### Creating Social Network

[](#creating-social-network)

```
$socialNetwork = SocialNetworks::create([
    'provider' => 'vkontakte',
    'short_name' => 'vk'
]);
```

### Attach Social Account

[](#attach-social-account)

```
$user->attachSocialAccountById($socialNetwork->id, $vkData);
```

or

```
$user->attachSocialAccountByShortName('vk', $vkData);
```

or

```
$user->attachSocialAccountByProvider('vkontakte', $vkData);
```

### Detach Social Account

[](#detach-social-account)

```
$user->detachSocialAccountById($socialNetwork->id);
```

or

```
$user->detachSocialAccountByShortName('vk');
```

or

```
$user->detachSocialAccountByProvider('vkontakte');
```

### Checking

[](#checking)

```
$user->hasSocialAccountById($socialNetwork->id);
```

or

```
$user->hasSocialAccountByShortName('vk');
```

or

```
$user->hasSocialAccountByProvider('vkontakte');
```

### Blade Extensions

[](#blade-extensions)

```
@providerExists('vkontakte') {
// see detach button, etc..
}

@providerNotExists('vkontakte') {
// see attach button, etc..
}
```

> For more information visit trait `HasSocialAccount` or contract `HasSocialAccount`

License
-------

[](#license)

This package is free software distributed under the terms of the MIT license.

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

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 ~114 days

Total

2

Last Release

3617d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/9404036?v=4)[Artemy](/maintainers/lartie)[@lartie](https://github.com/lartie)

---

Tags

accountauthcomposerlaravellaravel-packagesocialsocial-networkssocialitelaravelsocialilluminateattach-socialsocial-account

### Embed Badge

![Health badge](/badges/lartie-attach-social-account/health.svg)

```
[![Health](https://phpackages.com/badges/lartie-attach-social-account/health.svg)](https://phpackages.com/packages/lartie-attach-social-account)
```

###  Alternatives

[acoustep/entrust-gui

A GUI for the Entrust package.

11026.1k](/packages/acoustep-entrust-gui)[codebot/entrust

This package provides a flexible way to add Role-based Permissions to Laravel

15100.1k](/packages/codebot-entrust)

PHPackages © 2026

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