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
Include SendADF in your project with Composer:
composer require carmelosantana/sendadf
Requirements:
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' );
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 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>
prospect
tag is opened with status new without callingaddProspect
.addRequestdate
current server time is used as the default forrequestdate
when none is provided.name
part and type are provided.phone
type 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.
- 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
,objects
andJSON
Community support available on Discord.
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
- 0.3.0 - Aug 6, 2024
- Fix psr-4 namespace
- Update all methods from underscores to camelCase
- Update PHP requirements
The code is licensed MIT and the documentation is licensed CC BY-SA 4.0.