Skip to content

Commit

Permalink
Merge pull request #4 from avadev/UpdateComposerJson
Browse files Browse the repository at this point in the history
Cleaning up the composer and the intro page
  • Loading branch information
ted-spence-avalara authored Feb 13, 2017
2 parents df64cf7 + eb0e575 commit 7b8df78
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ To use the AvaTax PHP SDK from Composer:
* Add a `composer.json` file to your project and link to AvaTax:

```json
{
"require": {
"avalara/avataxclient": "*"
},
}
}
```

* Run `composer install` to download the latest version.
Expand All @@ -40,7 +42,7 @@ The PHP SDK uses a fluent interface to define a connection to AvaTax and to make
<?php
// Include the AvaTaxClient library
require_once '/src/AvaTaxClient.php';
require __DIR__ . '/vendor/autoload.php';
use Avalara\AvaTaxClient;
// Create a new client
Expand All @@ -50,14 +52,16 @@ $client->withSecurity('myUsername', 'myPassword');
// If I am debugging, I can call 'Ping' to see if I am connected to the server
$p = $client->Ping();
if ($p->authenticated) {
echo 'Success!'
echo '<p>Authenticated!</p>';
}
// Create a simple transaction for $100 using the fluent transaction builder
$tb = new Avalara\TransactionBuilder($client, $testCompany->companyCode, Avalara\DocumentType::C_SALESINVOICE, 'ABC');
$t = $tb->withAddress('SingleLocation', '123 Main Street', null, null, 'Irvine', 'CA', '92615', 'US')
->withLine(100.0, 1, "P0000000")
->create();
echo('<h2>Transaction #1</h2>');
echo('<pre>' . json_encode($t, JSON_PRETTY_PRINT) . '</pre>');
// Now, let's create a more complex transaction!
$tb = new Avalara\TransactionBuilder($client, $testCompany->companyCode, Avalara\DocumentType::C_SALESINVOICE, 'ABC');
Expand All @@ -71,6 +75,8 @@ $t = $tb->withAddress('ShipFrom', '123 Main Street', null, null, 'Irvine', 'CA',
->withLineAddress(Avalara\TransactionAddressType::C_SHIPTO, "1500 Broadway", null, null, "New York", "NY", "10019", "US")
->withLine(50.0, 1, "FR010000")
->create();
echo('<h2>Transaction #2</h2>');
echo('<pre>' . json_encode($t, JSON_PRETTY_PRINT) . '</pre>');
?>
```
7 changes: 7 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
"name": "Avalara Developer Relations",
"homepage": "https://developer.avalara.com"
},
{
"name": "Community Developer Forum",
"homepage": "https://community.avalara.com"
},
{
"name": "Ted Spence",
"email": "[email protected]"
Expand All @@ -37,5 +41,8 @@
"forum": "https://community.avalara.com",
"source": "https://github.com/avadev/AvaTaxClientLibrary",
"issues": "https://github.com/avadev/AvaTaxClientLibrary/issues"
},
"autoload": {
"psr-4": {"Avalara\\": "src"}
}
}

0 comments on commit 7b8df78

Please sign in to comment.