carmelosantana/sendadf
Composer 安装命令:
composer require carmelosantana/sendadf
包简介
Library to build valid Auto-Lead Data Format ADF/XML leads.
README 文档
README
PHP library that builds valid Auto-Lead Data Format ADF/XML leads.
Supports
Features
- Complete ADF implementation
- Validate tags and attributes (optional)
- Custom tags and attributes
- Data entry via an associative
array,object, orJSON - Attempts date conversion to ISO 8601:1988
- Default attributes for
name,phone,prospect, andvehicle
Install
Include SendADF in your project with Composer:
composer require carmelosantana/sendadf
Requirements:
Usage
Basic lead
This example lead represents the minimum data required to comply with ADF specifications.
$adf = ( new CarmeloSantana\SendAdf\SendAdf() ) ->addProspect( 'new' ) ->addRequestdate( '2/9/2020 6:26PM' ) ->addVehicle( [ 'year' => 1999, 'make' => 'Chevrolet', 'model' => 'Blazer' ], 'buy', 'used' ) ->addCustomer() ->addContact() ->addName( 'John Doe' ) ->addPhone( '393-999-3922' ) ->addVendor() ->addContact() ->addName( 'Acura of Bellevue' );
Output
Basic output with no tabs.
echo $adf->getXml();
<?xml version="1.0" encoding="UTF-8"?> <?adf version="1.0"?> <adf><prospect status="new"><requestdate>2020-02-09T18:26:00-05:00</requestdate><vehicle interest="buy" status="used"><year>1999</year><make>Chevrolet</make><model>Blazer</model></vehicle><customer><contact><name part="full" type="individual">John Doe</name><phone type="voice" time="nopreference">393-999-3922</phone></contact></customer><vendor><contact><name part="full" type="individual">Acura of Bellevue</name></contact></vendor></prospect></adf>
Pretty print output.
echo $adf->getPrettyPrintXML();
<?xml version="1.0" encoding="UTF-8"?> <?adf version="1.0"?> <adf> <prospect status="new"> <requestdate>2020-02-09T18:26:00-05:00</requestdate> <vehicle interest="buy" status="used"> <year>1999</year> <make>Chevrolet</make> <model>Blazer</model> </vehicle> <customer> <contact> <name part="full" type="individual">John Doe</name> <phone type="voice" time="nopreference">393-999-3922</phone> </contact> </customer> <vendor> <contact> <name part="full" type="individual">Acura of Bellevue</name> </contact> </vendor> </prospect> </adf>
Default values
Default attribute values are added if none are supplied. This is to adhere to the ADF standard.
$adf = ( new CarmeloSantana\SendAdf\SendAdf() ) ->addRequestdate() ->addVehicle( [ 'year' => 2020, 'make' => 'Chevrolet', 'model' => 'Blazer' ] ) ->addCustomer() ->addContact() ->addName( 'John Doe' ) ->addPhone( '393-999-3922' ); echo $adf->getPrettyPrintXML();
<?xml version="1.0" encoding="UTF-8"?> <?adf version="1.0"?> <adf> <prospect status="new"> <requestdate>2021-02-09T19:32:16-05:00</requestdate> <vehicle interest="buy" status="new"> <year>1999</year> <make>Chevrolet</make> <model>Blazer</model> </vehicle> <customer> <contact> <name part="full" type="individual">John Doe</name> <phone type="voice" time="nopreference">393-999-3922</phone> </contact> </customer> </prospect> </adf>
prospecttag is opened with status new without callingaddProspect.addRequestdatecurrent server time is used as the default forrequestdatewhen none is provided.namepart and type are provided.phonetype and time are provided.
Default values can be avoided by using addProspectparent_node and addNode as seen in example 3.
Sending empty values as shown in example 1 can disable these attributes as well.
Examples
- Bare minimum to get started
- Full document with all elements and attribute examples
- Avoid default values
- Manually open and close nodes
- Disable validation
- Custom tags and attributes
- Data entry via
arrays,objectsandJSON
Support
Community support available on Discord.
Funding
If you find this project useful or use it in a commercial environment please consider donating today with one of the following options.
- Bitcoin
bc1qhxu9yf9g5jkazy6h4ux6c2apakfr90g2rkwu45 - Ethereum
0x9f5D6dd018758891668BF2AC547D38515140460f - Patreon
patreon.com/carmelosantana - PayPal
https://www.paypal.com/donate
Changelog
- 0.3.0 - Aug 6, 2024
- Fix psr-4 namespace
- Update all methods from underscores to camelCase
- Update PHP requirements
License
The code is licensed MIT and the documentation is licensed CC BY-SA 4.0.
carmelosantana/sendadf 适用场景与选型建议
carmelosantana/sendadf 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 637 次下载、GitHub Stars 达 5, 最近一次更新时间为 2020 年 12 月 31 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「xml」 「crm」 「vehicle」 「leads」 「adf」 「automotive」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 carmelosantana/sendadf 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 carmelosantana/sendadf 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 carmelosantana/sendadf 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PHP library for integrating 54grad.de's vehicle labeling services.
A PHP client for the Salesforce SOAP API
API client for the DVLA's Vehicle Enquiry Service API
PHP library to validate and format license plate numbers.
Vehicle logotypes set
Load DOM document safety
统计信息
- 总下载量: 637
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-12-31