2017 © Pedro Peláez
 

library laravel-kuainiu

API client wrapper for Laravel & Connect provider for Laravel Socialite

image

kuainiu/laravel-kuainiu

API client wrapper for Laravel & Connect provider for Laravel Socialite

  • Monday, May 28, 2018
  • by summic
  • Repository
  • 1 Watchers
  • 0 Stars
  • 42 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 6 Versions
  • 110 % Grown

The README.md

Laravel-Kuainiu

Laravel-Kuainiu incorporates Kuainiu Connect and the Kuainiu API into your Laravel, (*1)

Requirements

Installation

Add Laravel-Kuainiu to your composer file via the composer require command:, (*2)

$ composer require kuainiu/laravel-kuainiu

Or add it to composer.json manually:, (*3)

"require": {
    "kuainiu/laravel-kuainiu": "~1.0"
}

Configuration

To get started, you'll need to publish all vendor assets:, (*4)

$ php artisan vendor:publish --provider="Kuainiu\KuainiuServiceProvider"

This will create a config/kuainiu.php file in your app that you can modify to set your configuration., (*5)

Kuainiu PAssport Connect with Laravel Socialite

If you intend on using Kuainiu Connect, update config/services.php by adding this to the array:, (*6)

'kuainiu' => [
    'oauthServerDomain' => env('KUAINIU_OAUTH_DOMAIN'),
    'client_id'         => env('KUAINIU_CLIENT_ID', 'app_xxx'),
    'client_secret'     => env('KUAINIU_CLIENT_SECRET'),
    'redirect'          => env('KUAINIU_REDIRECT_URI'),
],

To make sure Laravel Socialite can actually find the Kuainiu driver, use the following code snippet and paste it in the boot() method from your AppServiceProvider.php., (*7)

Socialite::extend('kuainiu', function ($app) {
    $config = $app['config']['services.kuainiu'];

    return Socialite::buildProvider('Kuainiu\KuainiuConnectProvider', $config);
});

Usage

Here you can see an example of just how simple this package is to use., (*8)

Kuainiu API


$user = Kuainiu::api()->user()->create([ "name" => 'user_name_', "mobile" => "13800138000" ]); $user = Kuainiu::createUser(['name'=>'name']); if ($user->isCreated()) { echo "User Created."; }

Kuainiu Passport Connect with Laravel Socialite

Route::get('login', function () {
    return Socialite::with('kuainiu')
        ->scopes('profiles.read profiles.write') // Additional permission: profiles.read profiles.write(the string need space separator)
        ->redirect();
});

Route::get('kuainiu/user/auth', function () {
    $user = Socialite::with('kuainiu')->stateless()->user();
    dd($user);
});

License

Copyright (c) 2018, Kuainiu Group, (*9)

The Versions

28/05 2018

dev-master

9999999-dev https://github.com/kuainiu/laravel-kuainiu

API client wrapper for Laravel & Connect provider for Laravel Socialite

  Sources   Download

BSD-2-Clause

The Requires

 

The Development Requires

socialite kuainiu

28/05 2018

1.1.0

1.1.0.0 https://github.com/kuainiu/laravel-kuainiu

API client wrapper for Laravel & Connect provider for Laravel Socialite

  Sources   Download

BSD-2-Clause

The Requires

 

The Development Requires

socialite kuainiu

25/05 2018

1.0.3

1.0.3.0 https://github.com/kuainiu/laravel-kuainiu

API client wrapper for Laravel & Connect provider for Laravel Socialite

  Sources   Download

BSD-2-Clause

The Requires

 

The Development Requires

socialite kuainiu

24/05 2018

1.0.2

1.0.2.0 https://github.com/kuainiu/laravel-kuainiu

API client wrapper for Laravel & Connect provider for Laravel Socialite

  Sources   Download

BSD-2-Clause

The Requires

 

The Development Requires

socialite kuainiu

24/05 2018

1.0.1

1.0.1.0 https://github.com/kuainiu/laravel-kuainiu

API client wrapper for Laravel & Connect provider for Laravel Socialite

  Sources   Download

BSD-2-Clause

The Requires

 

The Development Requires

socialite kuainiu

16/05 2018

1.0.0

1.0.0.0 https://github.com/kuainiu/laravel-kuainiu

API client wrapper for Laravel & Connect provider for Laravel Socialite

  Sources   Download

BSD-2-Clause

The Requires

 

The Development Requires

socialite kuainiu