2017 © Pedro Peláez
 

library facebook-authentication-adapter

Adapter for communication with Facebook GRAPH API

image

lzakrzewski/facebook-authentication-adapter

Adapter for communication with Facebook GRAPH API

  • Sunday, February 7, 2016
  • by lzakrzewski
  • Repository
  • 0 Watchers
  • 7 Stars
  • 71 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 8 Versions
  • 51 % Grown

The README.md

FacebookAuthenticationAdapter

Build Status Latest Stable Version Total Downloads, (*1)

Adapter for communication with Facebook GRAPH API., (*2)

FacebookAuthenticationAdapter is simple library for communication with Facebook GRAPH API. It returns access token and user node as array. Read about facebook api access tokens., (*3)

This library is independent part of FacebookAuthenticationBundle., (*4)

<?php

namespace Lzakrzewski\FacebookAuthenticationAdapter\Adapter;

interface FacebookApi
{
    const GRAPH_API_ME_URL = 'https://graph.facebook.com/v2.5/me';
    const GRAPH_API_ACCESS_TOKEN_URL = 'https://graph.facebook.com/v2.5/oauth/access_token';

    /**
     * Returns access token during code exchange.
     *
     * @param $code
     *
     * @throws FacebookApiException
     *
     * @return string
     */
    public function accessToken($code);

    /**
     * Returns a single user node as array.
     *
     * @param string $accessToken
     * @param array  $fields
     *
     * @throws FacebookApiException
     *
     * @return array
     */
    public function me($accessToken, array $fields = array());
}

Requirements

  "require": {
    "php": ">=5.4",
    "guzzlehttp/guzzle": "~5.0"
  }

Supported Facebook API version

  • v2.5

Installation

Require the library with composer:, (*5)

composer require lzakrzewski/facebook-authentication-adapter "~1.0"

Example

<?php

require 'vendor/autoload.php';

if (!isset($_GET['code'])) {
    header("Location: https://www.facebook.com/v2.5/dialog/oauth");
}

if (isset($_GET['code'])) {

    $client = new GuzzleHttp\Client();
    $adapter = new Lzakrzewski\FacebookAuthenticationAdapter\Adapter\GuzzleFacebookApi($client, 'http://my.host/login', 123123123123123, 'app-secret');

    $accessToken = $adapter->accessToken($_GET['code']);
    $userNode = $adapter->me($accessToken, array('first_name', 'last_name', 'gender', 'email', 'birthday', 'name'));

    //Your own logic to process facebook user node
}

The Versions

07/02 2016

dev-master

9999999-dev

Adapter for communication with Facebook GRAPH API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar lzakrzewski

07/02 2016

1.0.7

1.0.7.0

Adapter for communication with Facebook GRAPH API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar lzakrzewski

14/10 2015

1.0.6

1.0.6.0

Adapter for communication with Facebook GRAPH API

  Sources   Download

MIT

The Requires

 

The Development Requires

by lucaszz111

14/10 2015

1.0.5

1.0.5.0

Adapter for communication with Facebook GRAPH API

  Sources   Download

MIT

The Requires

 

The Development Requires

by lucaszz111

13/10 2015

1.0.4

1.0.4.0

Adapter for communication with Facebook GRAPH API

  Sources   Download

MIT

The Requires

 

The Development Requires

by lucaszz111

12/10 2015

1.0.2

1.0.2.0

Adapter for communication with Facebook GRAPH API

  Sources   Download

MIT

The Requires

 

The Development Requires

by lucaszz111

12/10 2015

1.0.3

1.0.3.0

Adapter for communication with Facebook GRAPH API

  Sources   Download

MIT

The Requires

 

The Development Requires

by lucaszz111

10/10 2015

1.0.1

1.0.1.0

Adapter for communication with Facebook GRAPH API

  Sources   Download

MIT

The Requires

 

The Development Requires

by lucaszz111