atanenl/twinfield
Composer 安装命令:
composer require atanenl/twinfield
包简介
Library for using the Twinfield Soap Service.
关键字:
README 文档
README
A PHP library for Twinfield Integration. Developed by Remco Tolsma and Leon Rowland from Pronamic. Use the Twinfield SOAP Service to have your PHP application communicate directly with your Twinfield account.
Autoloading
The classes follow the PSR2 naming convention.
Usage
General Usage Information
Components will have Factories to simplify the request and send process of Twinfield. Each factory will require just the \Pronamic\Twinfield\Secure\Config() class with the filled in details.
An example of the usage of the Configuration class.
$config = new \Pronamic\Twinfield\Secure\Config(); $config->setCredentials('Username', 'Password', 'Organization', 'Office');
- or, when using OAuth:
$config = new \Pronamic\Twinfield\Secure\Config(); $config->setOAuthParameters('clientID', 'clientSecret', 'returnURL', 'Organization', 'Office', true); //the true parameter at the end tells the system to automatically redirect to twinfield to login
Now, to the current modules
In the following example, we will use the Customer component as showcase. Although this will be the method for all components ( including Invoice currently )
Typically it is as follows, if using the Factories
- Add/Edit: Make Object, Make Factory, Give object in Submit method of related factory.
- Retrieve: Make Factory, Supply all required params to respective listAll() and get() methods
Add/Edit
Make your Customer object
$customer = new \Pronamic\Twinfield\Customer\Customer(); $customer ->setID(10666) ->setName('Leon Rowland') ->setType('DEB') ->setWebsite('http://leon.rowland.nl') ->setEBilling(true) ->setEBillMail('leon@rowland.nl') ->setVatCode('VL') ->setDueDays(10) ->setCocNumber('12341234');
Customers can have addresses associated with them
$customerAddress = new \Pronamic\Twinfield\Customer\CustomerAddress(); $customerAddress ->setDefault(false) ->setType('invoice') ->setField1('Testing field 1') ->setField2('Testing field 2') ->setField3('Testing field 3') ->setPostcode('1212 AB') ->setCity('TestCity') ->setCountry('NL') ->setTelephone('010-12345') ->setFax('010-1234') ->setEmail('test@email.com');
Assign that address to the customer
$customer->addAddress($customerAddress);
Now lets submit it!
use \Pronamic\Twinfield\Customer as TwinfieldCustomer; // Config object prepared and passed to the CustomerFactory $customerFactory = new TwinfieldCustomer\CustomerFactory($config); //$customer = new TwinfieldCustomer\Customer(); // Attempt to send the Customer document if($customerFactory->send($customer)){ // Use the Mapper to turn the response back into a TwinfieldCustomer\Customer $successfulCustomer = TwinfieldCustomer\Mapper\CustomerMapper::map($customerFactory->getResponse()); }
Retrieve/Request
You can get all customers or get a single one currently.
use \Pronamic\Twinfield\Customer as TwinfieldCustomer; // Config object prepared and passed into the CustomerFactory $customerFactory = new TwinfieldCustomer\CustomerFactory($config); $customers = $customerFactory->listAll();
At the moment, listAll will return an array of just name and short name.
$customer = $customerFactory->get('customerCode', 'office[optional]');
The response from get() will be a \Pronamic\Twinfield\Customer\Customer object.
Notes
Advanced documentation coming soon. Detailing usage without the Factory class. Giving you more control with the response and data as well as more in-depth examples and usage recommendations.
Contribute
You can contribute to the development of this project. Try and keep to the way of doing things as the other 2 components have implemented.
A large requirement is to maintain backwards compatibility so if you have any plans for large restructure or alteration please bring up in an issue first.
| Component | get() | listAll() | send() | Mapper | Namespace |
|---|---|---|---|---|---|
| Customer | ✅ | ✅ | ✅ | ✅ | Pronamic/Twinfield/Customer |
| Project | ✅ | ✅ | ✅ | ✅ | Pronamic/Twinfield/Project |
| Sales Invoices | ✅ | ✅ | ✅ | ✅ | Pronamic/Twinfield/Invoice |
| Transactions: Purchase | ✅ browse code 020 |
✅ | Pronamic/Twinfield/PurchaseInvoice | ||
| Transactions: Sale | ✅ | Pronamic/Twinfield/Transaction | |||
| Articles | Pronamic/Twinfield/Article | ||||
| Balance Sheets | Pronamic/Twinfield/BalanceSheet | ||||
| Suppliers | Pronamic/Twinfield/Supplier | ||||
| Dimension Groups | Pronamic/Twinfield/Dimension/Group | ||||
| Dimension Types | ✅ | ✅ | ✅ | ✅ | Pronamic/Twinfield/DimensionType |
| Offices | ✅ | Pronamic/Twinfield/Office | |||
| Vat types | ✅ | Pronamic/Twinfield/VatCode |
Build
- npm install
- composer install
Links
- Twinfield API Documentation site
- Twinfield Library for Python
- Using Grunt for PHP
- Using Grunt with PHP Quality Assurance Tools
Authors
License
Copyright 2009-2013 Pronamic.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
atanenl/twinfield 适用场景与选型建议
atanenl/twinfield 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 47.52k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2016 年 04 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「twinfield」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 atanenl/twinfield 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 atanenl/twinfield 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 atanenl/twinfield 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
统计信息
- 总下载量: 47.52k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL
- 更新时间: 2016-04-08