vinou/api-connector
Composer 安装命令:
composer require vinou/api-connector
包简介
Vinou API Connnector
README 文档
README
The Vinou API Connector is a PHP library that provides the stable functions and utilities that are enabled within the Vinou-Service-API and the Vinou-Public-API.
Table of contents
Installation
composer install vinou/api-connector
Usage Example
1. Basic instantiation
$api = new \Vinou\ApiConnector\Api ( TOKEN_FOR_INSTANCE, AUTHID_FOR_VINOU_CUSTOMER );
2. Instantiation with settings (recommended)
At first use constants to define path to config.yml
define(VINOU_CONFIG_DIR, '/Path/to/settings.yml');
The settings.yml looks like (Be careful keys are case sensitive)
vinou: token: TOKEN_FOR_INSTANCE authid: AUTHID_FOR_VINOU_CUSTOMER
than you can instantiate without piping the variables to the API-Object
$api = new \Vinou\ApiConnector\Api();
3. Improve session handling
By default the generated login token is stored to session. If you want to configure some additional api parameters or if you have some login issues it is better to instantiate a specific Vinou-Session before.
$session = new \Vinou\ApiConnector\Session\Session (); $session::setValue('language','de');
This session handling is able to detect a TYPO3 session
4. Example function call
// returns all public wines of your Vinou-Office Account as php array $api->getWinesAll()
5. Prepare Ajax connection (content of ajax.php e.g. called via https://your.domain.com/ajax.php)
<?php require_once __DIR__ . '/../vendor/autoload.php'; define('VINOU_ROOT', realpath('./')); define('VINOU_MODE', 'Ajax'); define('VINOU_CONFIG_DIR', '../config/'); header('Cache-Control: no-cache, must-revalidate'); header('Content-type: application/json'); // INIT SESSION BEFORE ALL THE OTHER STUFF STARTS $session = new \Vinou\ApiConnector\Session\Session (); $session::setValue('language','de'); $ajax = new \Vinou\ApiConnector\Ajax (); $ajax->run(); ?>
Constants
Main options are set by constants. The following constants are avaiable.
| Constant | Default | Options | Description |
|---|---|---|---|
VINOU_ROOT |
[DOCROOT] | /Path/to/application/dir |
Improvement settings for some older environments if document root is not correctly set via server variable |
VINOU_CONFIG_DIR |
not set | /Path/to/settings.yml |
If set use configuration via settings.yml] |
VINOU_LOG_DIR |
logs/ | /Path/to/log/dir/ |
Directory for logfiles |
VINOU_LOG_LEVEL |
ERROR | Loglevel from monolog | |
VINOU_DEBUG |
false | Boolean | If set special breakpoints in sdk are written to logfiles |
VINOU_MODE |
not set | Shop |
load only objects marked with shop flag in Vinou-Office |
Winelist |
load only objects marked as public in Vinou-Office | ||
VINOU_SOURCE |
Live | Live |
Use production API https://api.vinou.de |
Staging |
Use staging API https://api.staging.vinou.de (Ready to use features) | ||
Dev |
Use development API https://api.developmentvinou.de (All new features up from alpha status) |
Classlist
| Class | Description |
|---|---|
| \Vinou\ApiConnector\Api | Main API SDK class |
| \Vinou\ApiConnector\PublicApi | API SDK for small public API |
| \Vinou\ApiConnector\Ajax | Class to handle local json ajax requests to API |
| \Vinou\ApiConnector\FileHandler\Images | File handling to store and cache api images in local application |
| \Vinou\ApiConnector\FileHandler\Pdf | File handling to store and cache api PDFs in local application |
| \Vinou\ApiConnector\Session\Session | Main session class to instantiate, get, set and delete session variables |
| \Vinou\ApiConnector\Session\TYPO3Session | Class that is used to use TYPO3 sesions |
| \Vinou\ApiConnector\Tools\Helper | Some static helper functions e.g. get api urls depending on environment |
| \Vinou\ApiConnector\Tools\Redirect | Helper class to do internal and external redirects |
Provider
This Library is developed by the Vinou GmbH.
Vinou GmbH
Justus-von-Liebig-Straße 9e
55232 Alzey
E-Mail: kontakt@vinou.de
Phone: +49 6131 6245390
vinou/api-connector 适用场景与选型建议
vinou/api-connector 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 988 次下载、GitHub Stars 达 2, 最近一次更新时间为 2020 年 09 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「Vinou」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 vinou/api-connector 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 vinou/api-connector 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 vinou/api-connector 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PSR-7 compatible library for making CRUD API endpoints
Vinou Translation files
PHP library to generate template based webpages with dynamic content from the Vinou Plattform
Extension that provides a connection for vinou.de and display wines and winelists via fluid templates
A lightweight plain-PHP framework for database-backed CRUD APIs.
Modern, strongly-typed, PSR-compliant PHP client for the WeFact v2 API.
统计信息
- 总下载量: 988
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 11
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0
- 更新时间: 2020-09-06