定制 terminal42/webling-api 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

terminal42/webling-api

最新稳定版本:1.0.0

Composer 安装命令:

composer require terminal42/webling-api

包简介

API client for webling.ch

README 文档

README

An API client for the REST API of webling.ch.

This client is currently used for our own projects and might not support all cases. Feel free to open issues or pull requests for questions or feature requests.

Installation

$ composer.phar require terminal42/webling-api ^2.0@dev

If you are using Symfony, we recommend using our Webling Bundle.

Usage

$subdomain  = 'meinverein';
$apiKey     = 'foobar';
$apiVersion = '1';

$client = new Client($subdomain, $apiKey, $apiVersion);

// Example call for member list:
$client->get('member');

The EntityManager

If you're looking for a more convenient way to work with the API instead of calling it directly, you can work with the EntityManager.

The main issue with the webling API is the fact that requesting resource lists (e.g. /member) will only return an array of object ID's instead of additional data like the member last name or first name.

The EntityList will take care of this and lazy load the additional details whenever you need them. That way you can easily iterate over a list of members:

$em = EntityManager::createForAccount($subdomain, $apiKey);

$entityList = $em->findAll('member');

foreach ($entityList as $member) {

    echo $member->getId();
    echo $member->getProperty('Name');
    var_dump($member->getProperties());
    // etc.
}

The QueryBuilder

The QueryBuilder components allows to find entities using complex search queries. It is highly recommended to use an IDE with code autocompletion for easy usage.

Example 1: find member by name

$qb = new QueryBuilder();
$query = $qb->where('Firstname')->isEqualTo('Max')->andWhere('Lastname')->isEqualTo('Muster')->build();

Result: Firstname = "Max" AND Lastname = "Muster"

Example 2: find member by complex conditions

$qb = new QueryBuilder();

$query = $qb
    ->group(
        $qb->where('Firstname')->isEqualTo('Max')->andWhere('Lastname')->isEqualTo('Muster')
    )
    ->orGroup(
        $qb->where('Firstname')->isEqualTo('Muster')->andWhere('Lastname')->isEqualTo('Max')
    )
    ->build()
;

Result: '(Firstname = "Max" AND Lastname = "Muster") OR (Lastname = "Max" AND "Firstname" = "Muster")'

统计信息

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

GitHub 信息

  • Stars: 6
  • Watchers: 7
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0
  • 更新时间: 2015-05-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固