draugiem/draugiem-php-sdk

本包的最新版本(v1.3.7)没有可用的许可证信息。

Draugiem.lv API PHP库

v1.3.7 2018-01-25 11:05 UTC

This package is not auto-updated.

Last update: 2024-09-28 16:03:13 UTC


README

Draugiem.lv API PHP库

Latest Stable Version Latest Unstable Version

为了使应用程序开发更快、更简单,我们创建了一个PHP库,该库执行API调用并将请求的数据自动转换为PHP数据结构。PHP库可用于集成应用程序和draugiem.lv Passport应用程序。

该库需要PHP5环境,并使用PHP会话机制在会话中存储用户数据。为了执行API调用,您必须启用PHP配置中的文件_get_contents函数对HTTP URL的访问(在PHP配置中启用allow_url_fopen设置)。

为了使用PHP库,您必须在您的应用程序中包含DraugiemApi.php文件。

用法

查看示例,了解更多如何使用API库。

require 'DraugiemApi.php';

$draugiem = new DraugiemApi( 'YOUR_APP_ID', 'YOUR_APP_KEY' );

session_start();
$draugiem->cookieFix(); // Iframe cookie workaround for IE and Safari

$session = $draugiem->getSession();
if ($session) {
	$user = $draugiem->getUserData(); //Get user info
}

使用composer使用

  1. 将此包添加到您的composer.json

    "draugiem/draugiem-php-sdk": "1.3.*"
  2. 更新composer.json包

    composer update
    
  3. 示例所示使用库

    $draugiem = new DraugiemApi( 'YOUR_APP_ID', 'YOUR_APP_KEY' );