lzakrzewski/facebook-authentication-adapter 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

lzakrzewski/facebook-authentication-adapter

Composer 安装命令:

composer require lzakrzewski/facebook-authentication-adapter

包简介

Adapter for communication with Facebook GRAPH API

README 文档

README

Build Status Latest Stable Version Total Downloads

Adapter for communication with Facebook GRAPH API.

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.

This library is independent part of FacebookAuthenticationBundle.

<?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:

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
}

统计信息

  • 总下载量: 115
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 3
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-02-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固