2017 © Pedro Peláez
 

library phalcon-ulogin

Phalcon ULogin. The authorization form uLogin through social networks

image

stanislav-web/phalcon-ulogin

Phalcon ULogin. The authorization form uLogin through social networks

  • Wednesday, January 28, 2015
  • by stanislav-web
  • Repository
  • 4 Watchers
  • 6 Stars
  • 109 Installations
  • PHP
  • 1 Dependents
  • 5 Suggesters
  • 2 Forks
  • 1 Open issues
  • 3 Versions
  • 4 % Grown

The README.md

Phalcon ULogin

Build Status Code Coverage Scrutinizer Code Quality Total Downloads License Latest Stable Version, (*1)

Phalcon ULogin. The authorization form uLogin through social networks, (*2)

ULogin, (*3)

Compatible

  • PSR-0, PSR-1, PSR-2, PSR-4 Standards

System requirements

  • PHP 5.4.x >
  • Phalcon extension 1.3.x
  • \Phalcon\Session in DI

Install

First update your dependencies through composer. Add to your composer.json:, (*4)

"require": {
    "stanislav-web/phalcon-ulogin": "1.0-stable"
}

```python php composer.phar install, (*5)

OR
```python
php composer.phar require stanislav-web/phalcon-ulogin dev-master

(Do not forget to include the composer autoloader), (*6)

Or manual require in your loader service, (*7)

    $loader->registerNamespaces([
        'ULogin\Auth' => 'path to src'
    ]);

You can create an injectable service, (*8)

    $this->di['ulogin'] = function() {
        return new ULogin\Auth();
    };

Usage

simple use (get socials as default)

    use ULogin\Auth;

    echo (new Auth())->getForm();

setup social widget

    echo (new Auth())->setType('window')->getForm(); // window, panel, small as default

setup providers for widget form

echo (new Auth())->setProviders([
                   'vkontakte'     =>  true,   // show inline
                   'odnoklassniki' =>  true,   // show inline
                   'facebook'      =>  false,  // show in drop down
                   'google'        =>  false,  // show in drop down
                   'yandex'        =>  true,   // show inline
    ])->setType('panel')->getForm();

or setup providers as string

    echo (new Auth())->setProviders('vkontakte=true,odnoklassniki=true,facebook=false,google=false,yandex=true')->setType('panel')->getForm();

setup redirect url (current path using as default)

    echo (new Auth())->setType('panel')->setUrl('?success')->getForm();

setup user fields getting from auth (optionals fields setup similary. Use setOptional())

    echo (new Auth())->setFields([
                   'first_name',
                   'last_name',
                   'photo',
                   'city'
              ])->getForm();

or setup fields as string

    echo (new Auth())->setFields('first_name,last_name,photo,city')->getForm();

alternate configuration

    $ulogin = new Auth(array(
            'fields'        =>  'first_name,last_name,photo,city',
            'providers'     =>  'vk=true,mailru=false,linkedin=false',
            'url'           =>  '/auth/?success',
            'type'          =>  'window'
        ));
    echo $ulogin->getForm();

get auth data

    $ulogin = new Auth();

    // print form
    echo $ulogin->setUrl('?success')->getForm();

    // handler

    $request = new \Phalcon\Http\Request();
    if($request->hasQuery('success') === true) {

        // check authorization
        if($ulogin->isAuthorised()) {

            // get auth token 
            echo $ulogin->getToken();

            // get  auth user data
            var_dump($ulogin->getUser());

            // logout
            $ulogin->logout();
        }
    }

Unit Test

Also available in /phpunit directory. Run command to start, (*9)

php build/phpunit.phar --configuration phpunit.xml.dist --coverage-text

Read logs from phpunit/log, (*10)

Issues

Screen

ULogin, (*11)

The Versions

28/01 2015

dev-master

9999999-dev https://github.com/stanislav-web/phalcon-ulogin

Phalcon ULogin. The authorization form uLogin through social networks

  Sources   Download

GPL-3.0

The Requires

  • php >=5.4.0

 

authorization social phalcon ulogin phalcon ulogin phalcon ulogin widget

27/12 2014

v1.0-stable

1.0.0.0 https://github.com/stanislav-web/phalcon-ulogin

Phalcon ULogin. The authorization form uLogin through social networks

  Sources   Download

GPL-3.0

The Requires

  • php >=5.4.0

 

authorization social phalcon ulogin phalcon ulogin phalcon ulogin widget

26/12 2014

v1.0-beta

1.0.0.0-beta https://github.com/stanislav-web/phalcon-ulogin

Phalcon ULogin. The authorization form uLogin through social networks

  Sources   Download

GPL3

The Requires

  • php >=5.3

 

authorization social phalcon ulogin phalcon ulogin phalcon ulogin widget