PHPackages                             fetchapp/fetchapp - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. fetchapp/fetchapp

ActiveLibrary[API Development](/categories/api)

fetchapp/fetchapp
=================

A PHP library for access to version 3.0 of the FetchApp API

22.7k8[1 issues](https://github.com/fetchapp/fetchapp-php-2.0/issues)[2 PRs](https://github.com/fetchapp/fetchapp-php-2.0/pulls)PHP

Since Feb 24Pushed 2y ago3 watchersCompare

[ Source](https://github.com/fetchapp/fetchapp-php-2.0)[ Packagist](https://packagist.org/packages/fetchapp/fetchapp)[ RSS](/packages/fetchapp-fetchapp/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

fetchapp-php-2.0
================

[](#fetchapp-php-20)

A PHP library for version 2.0 of the FetchApp API

Getting Account Information
---------------------------

[](#getting-account-information)

```
use FetchApp\API\FetchApp;

// Create a new FetchApp instance
$fetch = new FetchApp();

// Set the Authentication data (needed for all requests)
$fetch->setAuthenticationKey("demokey");
$fetch->setAuthenticationToken("demotoken");
try{
// Let's grab our Account data to make sure that everything is working!
    $account = $fetch->getAccountDetails();//    That was easy!

// Let's write some of the available Data to the page!
    echo $account->getAccountID();
    echo $account->getAccountName();
    echo $account->getBillingEmail();
    echo $account->getEmailAddress();
    echo $account->getURL();
    echo $account->getItemDownloadLimit();
    echo $account->getOrderExpirationInHours();
}
catch (Exception $e){
// This will occur on any call if the AuthenticationKey and AuthenticationToken are not set.
    echo $e->getMessage();
}
```

Getting Order Information
-------------------------

[](#getting-order-information)

### Getting All Orders

[](#getting-all-orders)

```
use FetchApp\API\FetchApp;
use FetchApp\API\OrderStatus;

// Create a new FetchApp instance
$fetch = new FetchApp();

// Set the Authentication data (needed for all requests)
$fetch->setAuthenticationKey("demokey");
$fetch->setAuthenticationToken("demotoken");;
try{
    // Let's grab our Orders!
    $orders = $fetch->getOrders(); // Grabs all orders (potentially HUGE!)
                    // or
    $orders = $fetch->getOrders(OrderStatus::All, 50, 4); // Grabs orders of all types, 50 per page, page 4.
                    // or
    $orders = $fetch->getOrders(OrderStatus::Expired); // Grabs all expired orders.
                    // or
    $orders = $fetch->getOrders(OrderStatus::Open); // Grabs all open orders
}
catch (Exception $e){
    // This will occur on any call if the AuthenticationKey and AuthenticationToken are not set.
    echo $e->getMessage();
}
// Now let's print our results!
foreach ($orders as $order) {
    echo $order->getOrderID().PHP_EOL;
    echo $order->getVendorID().PHP_EOL;
    echo $order->getFirstName().PHP_EOL;
    echo $order->getLastName().PHP_EOL;
    echo $order->getEmailAddress().PHP_EOL;
    echo $order->getTotal().PHP_EOL;
    echo $order->getCurrency().PHP_EOL;
    echo $order->getStatus().PHP_EOL;
    echo $order->getProductCount().PHP_EOL;
    echo $order->getDownloadCount().PHP_EOL;
    $expirationDate = $order->getExpirationDate();
    // Since ExpirationDate is a DateTime, we need to print it with a format.
    echo $expirationDate->format('F j, Y').PHP_EOL;
    echo $order->getDownloadLimit().PHP_EOL;
    echo $order->getCustom1().PHP_EOL;
    echo $order->getCustom2().PHP_EOL;
    echo $order->getCustom3().PHP_EOL;
    $creationDate = $order->getCreationDate();
    // Since CreationDate is a DateTime, we need to print it with a format.
    echo $creationDate->format('F j, Y').PHP_EOL;
}
```

### Getting a Single Order

[](#getting-a-single-order)

```
use FetchApp\API\FetchApp;
use FetchApp\API\OrderStatus;

// Create a new FetchApp instance
$fetch = new FetchApp();

// Set the Authentication data (needed for all requests)
$fetch->setAuthenticationKey("demokey");
$fetch->setAuthenticationToken("demotoken");
try{
    // Let's grab our Orders!
    $order = $fetch->getOrder("B007");
}
catch (Exception $e){
    // This will occur on any call if the AuthenticationKey and AuthenticationToken are not set.
    echo $e->getMessage();
}
// Now let's print our result!
echo $order->getOrderID().PHP_EOL;
echo $order->getVendorID().PHP_EOL;
echo $order->getFirstName().PHP_EOL;
echo $order->getLastName().PHP_EOL;
echo $order->getEmailAddress().PHP_EOL;
echo $order->getTotal().PHP_EOL;
echo $order->getCurrency().PHP_EOL;
echo $order->getStatus().PHP_EOL;
echo $order->getProductCount().PHP_EOL;
echo $order->getDownloadCount().PHP_EOL;
$expirationDate = $order->getExpirationDate();
// Since ExpirationDate is a DateTime, we need to print it with a format.
echo $expirationDate->format('F j, Y').PHP_EOL;
echo $order->getDownloadLimit().PHP_EOL;
echo $order->getCustom1().PHP_EOL;
echo $order->getCustom2().PHP_EOL;
echo $order->getCustom3().PHP_EOL;
$creationDate = $order->getCreationDate();
// Since CreationDate is a DateTime, we need to print it with a format.
echo $creationDate->format('F j, Y').PHP_EOL;
```

### Creating an Order

[](#creating-an-order)

```
use FetchApp\API\Currency;
use FetchApp\API\FetchApp;
use FetchApp\API\Order;
use FetchApp\API\OrderItem;

// Create a new FetchApp instance
$fetch = new FetchApp();

// Set the Authentication data (needed for all requests)
$fetch->setAuthenticationKey("demokey");
$fetch->setAuthenticationToken("demotoken");

try{
    $order = new Order();
    $order->setOrderID("B008");
    $order->setFirstName("James");
    $order->setLastName("Bond");
    $order->setEmailAddress("007@mi6.com");
    $order->setVendorID("M002");
    $order->setCurrency(Currency::GBP);
    $order->setCustom1("Herp");
    $order->setCustom3("Derp");
    $order->setExpirationDate(new DateTime("2015/12/24"));
    $order->setDownloadLimit(12);

    $items = array();
    // Add items to the item array
    $order_item = new OrderItem();
    $order_item->setSKU('TestSKU');
    array_push($items, $order_item);

    $response = $order->create($items, false);
}
catch (Exception $e){
    // This will occur on any call if the AuthenticationKey and AuthenticationToken are not set.
    echo $e->getMessage();
}
```

### Updating an Order

[](#updating-an-order)

```
use FetchApp\API\Currency;
use FetchApp\API\FetchApp;
use FetchApp\API\Order;
use FetchApp\API\OrderItem;

// Create a new FetchApp instance
$fetch = new FetchApp();

// Set the Authentication data (needed for all requests)
$fetch->setAuthenticationKey("demokey");
$fetch->setAuthenticationToken("demotoken");

try{
    $order = new FetchApp->getOrder(123);
    $order->setOrderID("B008");
    $order->setFirstName("James");
    $order->setLastName("Bond");
    $order->setEmailAddress("007@mi6.com");
    $order->setVendorID("M002");
    $order->setCurrency(Currency::GBP);
    $order->setCustom1("Herp");
    $order->setCustom3("Derp");
    $order->setExpirationDate(new DateTime("2015/12/24"));
    $order->setDownloadLimit(12);
    $items = $order->getItems(); // Get the existing order items

    $response = $order->update($items, false);
}
catch (Exception $e){
    // This will occur on any call if the AuthenticationKey and AuthenticationToken are not set.
    echo $e->getMessage();
}
```

### Deleting an Order

[](#deleting-an-order)

```
use FetchApp\API\Currency;
use FetchApp\API\FetchApp;
use FetchApp\API\Order;
use FetchApp\API\OrderItem;

// Create a new FetchApp instance
$fetch = new FetchApp();

// Set the Authentication data (needed for all requests)
$fetch->setAuthenticationKey("demokey");
$fetch->setAuthenticationToken("demotoken");

try{
    $order = new FetchApp->getOrder(123);
    $response = $order->delete();
}
catch (Exception $e){
    // This will occur on any call if the AuthenticationKey and AuthenticationToken are not set.
    echo $e->getMessage();
}
```

### Get statistics for an Order

[](#get-statistics-for-an-order)

```
use FetchApp\API\Currency;
use FetchApp\API\FetchApp;
use FetchApp\API\Order;
use FetchApp\API\OrderItem;
use FetchApp\API\OrderStatistic;

// Create a new FetchApp instance
$fetch = new FetchApp();

// Set the Authentication data (needed for all requests)
$fetch->setAuthenticationKey("demokey");
$fetch->setAuthenticationToken("demotoken");

try{
    $order = new FetchApp->getOrder(123);
    $statistics = $order->getStatistics();
}
catch (Exception $e){
    // This will occur on any call if the AuthenticationKey and AuthenticationToken are not set.
    echo $e->getMessage();
}
```

### Get Downloads for an Order

[](#get-downloads-for-an-order)

```
use FetchApp\API\Currency;
use FetchApp\API\FetchApp;
use FetchApp\API\Order;
use FetchApp\API\OrderItem;
use FetchApp\API\OrderDownload;

// Create a new FetchApp instance
$fetch = new FetchApp();

// Set the Authentication data (needed for all requests)
$fetch->setAuthenticationKey("demokey");
$fetch->setAuthenticationToken("demotoken");

try{
    $order = new FetchApp->getOrder(123);
    $downloads = $order->getDownloads();
}
catch (Exception $e){
    // This will occur on any call if the AuthenticationKey and AuthenticationToken are not set.
    echo $e->getMessage();
}
```

### Expire an Order

[](#expire-an-order)

```
use FetchApp\API\Currency;
use FetchApp\API\FetchApp;
use FetchApp\API\Order;
use FetchApp\API\OrderItem;

// Create a new FetchApp instance
$fetch = new FetchApp();

// Set the Authentication data (needed for all requests)
$fetch->setAuthenticationKey("demokey");
$fetch->setAuthenticationToken("demotoken");

try{
    $order = new FetchApp->getOrder(123);
    $response = $order->expire();
}
catch (Exception $e){
    // This will occur on any call if the AuthenticationKey and AuthenticationToken are not set.
    echo $e->getMessage();
}
```

### Re-send a download email for an Order

[](#re-send-a-download-email-for-an-order)

```
use FetchApp\API\Currency;
use FetchApp\API\FetchApp;
use FetchApp\API\Order;
use FetchApp\API\OrderItem;

// Create a new FetchApp instance
$fetch = new FetchApp();

// Set the Authentication data (needed for all requests)
$fetch->setAuthenticationKey("demokey");
$fetch->setAuthenticationToken("demotoken");

try{
    $order = new FetchApp->getOrder(123);
    $response = $order->sendDownloadEmail();
}
catch (Exception $e){
    // This will occur on any call if the AuthenticationKey and AuthenticationToken are not set.
    echo $e->getMessage();
}
```

Getting Product Information
---------------------------

[](#getting-product-information)

### Getting All Products

[](#getting-all-products)

```
use FetchApp\API\FetchApp;

// Create a new FetchApp instance
$fetch = new FetchApp();

// Set the Authentication data (needed for all requests)
$fetch->setAuthenticationKey("demokey");
$fetch->setAuthenticationToken("demotoken");;
try{
    // Let's grab our Products!
    $products = $fetch->getProducts(); // Grabs all products (potentially HUGE!)
                    // or
    $products = $fetch->getProducts(50, 4); // Grabs products, 50 per page, page 4.
}
catch (Exception $e){
    // This will occur on any call if the AuthenticationKey and AuthenticationToken are not set.
    echo $e->getMessage();
}
// Now let's print our results!
foreach ($products as $product) {
    echo $product->getProductID().PHP_EOL;
    echo $product->getName().PHP_EOL;
    echo $product->getSKU().PHP_EOL;
}
```

### Getting a Single Product

[](#getting-a-single-product)

```
use FetchApp\API\FetchApp;

// Create a new FetchApp instance
$fetch = new FetchApp();

// Set the Authentication data (needed for all requests)
$fetch->setAuthenticationKey("demokey");
$fetch->setAuthenticationToken("demotoken");
try{
    // Let's grab our Product!
    $product = $fetch->getProduct(123);
}
catch (Exception $e){
    // This will occur on any call if the AuthenticationKey and AuthenticationToken are not set.
    echo $e->getMessage();
}
// Now let's print our result!
echo $product->getProductID().PHP_EOL;
    echo $product->getName().PHP_EOL;
    echo $product->getSKU().PHP_EOL;
```

### Creating a Product

[](#creating-a-product)

```
use FetchApp\API\Currency;
use FetchApp\API\FetchApp;
use FetchApp\API\Product;

// Create a new FetchApp instance
$fetch = new FetchApp();

// Set the Authentication data (needed for all requests)
$fetch->setAuthenticationKey("demokey");
$fetch->setAuthenticationToken("demotoken");

try{
    $product = new Product();
    $product->setSKU(123);
    $product->setName("Test Product");
    $product->setPrice(3.00);
    $product->setCurrency(Currency::GBP);

    $files = array();
    // Add exisitng FileDetail objects

    $item_urls = array(array("url" => "http://s3.aws/download.mp3", "name" => "audio"));
    // Add external URLs for files in the above format

    $response = $product->create($files, $item_urls);
}
catch (Exception $e){
    // This will occur on any call if the AuthenticationKey and AuthenticationToken are not set.
    echo $e->getMessage();
}
```

### Updating a Product

[](#updating-a-product)

```
use FetchApp\API\Currency;
use FetchApp\API\FetchApp;
use FetchApp\API\Product;

// Create a new FetchApp instance
$fetch = new FetchApp();

// Set the Authentication data (needed for all requests)
$fetch->setAuthenticationKey("demokey");
$fetch->setAuthenticationToken("demotoken");

try{
    $product = new FetchApp->getProduct(123);
    $product->setSKU(123);
    $product->setName("Test Product");
    $product->setPrice(3.00);
    $product->setCurrency(Currency::GBP);

    $files = $product->getFiles();
    // Get the existing files attached to the product

    $item_urls = array(array("url" => "http://s3.aws/download.mp3", "name" => "audio"));
    // Add external URLs for files in the above format

    $response = $product->update($files, $item_urls);
}
catch (Exception $e){
    // This will occur on any call if the AuthenticationKey and AuthenticationToken are not set.
    echo $e->getMessage();
}
```

### Deleting a Product

[](#deleting-a-product)

```
use FetchApp\API\FetchApp;
use FetchApp\API\Product;

// Create a new FetchApp instance
$fetch = new FetchApp();

// Set the Authentication data (needed for all requests)
$fetch->setAuthenticationKey("demokey");
$fetch->setAuthenticationToken("demotoken");

try{
    $product = new FetchApp->getProduct(123);
    $response = $product->delete();
}
catch (Exception $e){
    // This will occur on any call if the AuthenticationKey and AuthenticationToken are not set.
    echo $e->getMessage();
}
```

### Get files for a Product

[](#get-files-for-a-product)

```
use FetchApp\API\FetchApp;
use FetchApp\API\Product;
use FetchApp\API\FileDetail;

// Create a new FetchApp instance
$fetch = new FetchApp();

// Set the Authentication data (needed for all requests)
$fetch->setAuthenticationKey("demokey");
$fetch->setAuthenticationToken("demotoken");

try{
    $product = new FetchApp->getProduct(123);
    $files = $product->getFiles();
}
catch (Exception $e){
    // This will occur on any call if the AuthenticationKey and AuthenticationToken are not set.
    echo $e->getMessage();
}
```

### Get statistics for a Product

[](#get-statistics-for-a-product)

```
use FetchApp\API\FetchApp;
use FetchApp\API\Product;
use FetchApp\API\ProductStatistic;

// Create a new FetchApp instance
$fetch = new FetchApp();

// Set the Authentication data (needed for all requests)
$fetch->setAuthenticationKey("demokey");
$fetch->setAuthenticationToken("demotoken");

try{
    $product = new FetchApp->getProduct(123);
    $statistics = $product->getStatistics();
}
catch (Exception $e){
    // This will occur on any call if the AuthenticationKey and AuthenticationToken are not set.
    echo $e->getMessage();
}
```

### Get Downloads for a Product

[](#get-downloads-for-a-product)

```
use FetchApp\API\FetchApp;
use FetchApp\API\Product;
use FetchApp\API\OrderDownload;

// Create a new FetchApp instance
$fetch = new FetchApp();

// Set the Authentication data (needed for all requests)
$fetch->setAuthenticationKey("demokey");
$fetch->setAuthenticationToken("demotoken");

try{
    $product = new FetchApp->getProduct(123);
    $downloads = $product->getDownloads();
}
catch (Exception $e){
    // This will occur on any call if the AuthenticationKey and AuthenticationToken are not set.
    echo $e->getMessage();
}
```

Getting OrderItem Information
-----------------------------

[](#getting-orderitem-information)

### Get all OrderItems for an Order

[](#get-all-orderitems-for-an-order)

```
use FetchApp\API\Currency;
use FetchApp\API\FetchApp;
use FetchApp\API\Order;
use FetchApp\API\OrderItem;

// Create a new FetchApp instance
$fetch = new FetchApp();

// Set the Authentication data (needed for all requests)
$fetch->setAuthenticationKey("demokey");
$fetch->setAuthenticationToken("demotoken");

try{
    $order = new FetchApp->getOrder(123);
    $items = $order->getItems(); // Get the existing order items
}
catch (Exception $e){
    // This will occur on any call if the AuthenticationKey and AuthenticationToken are not set.
    echo $e->getMessage();
}
```

### Get files for an OrderItem

[](#get-files-for-an-orderitem)

```
use FetchApp\API\FetchApp;
use FetchApp\API\OrderItem;
use FetchApp\API\FileDetail;

// Create a new FetchApp instance
$fetch = new FetchApp();

// Set the Authentication data (needed for all requests)
$fetch->setAuthenticationKey("demokey");
$fetch->setAuthenticationToken("demotoken");

try{
    $order = new FetchApp->getOrder(123);
    $items = $order->getItems(); // Get the existing order items
    foreach($items as $orderitem):
		$files = $orderitem->getFiles();
	endforeach;
}
catch (Exception $e){
    // This will occur on any call if the AuthenticationKey and AuthenticationToken are not set.
    echo $e->getMessage();
}
```

### Get Downloads for an OrderItem

[](#get-downloads-for-an-orderitem)

```
use FetchApp\API\FetchApp;
use FetchApp\API\OrderItem;
use FetchApp\API\OrderDownload;

// Create a new FetchApp instance
$fetch = new FetchApp();

// Set the Authentication data (needed for all requests)
$fetch->setAuthenticationKey("demokey");
$fetch->setAuthenticationToken("demotoken");

try{
	$order = new FetchApp->getOrder(123);
    $items = $order->getItems(); // Get the existing order items
    foreach($items as $orderitem):
	    $downloads = $orderitem->getDownloads();
	endforeach;
}
catch (Exception $e){
    // This will occur on any call if the AuthenticationKey and AuthenticationToken are not set.
    echo $e->getMessage();
}
```

Getting Download Information
----------------------------

[](#getting-download-information)

### Getting All Downloads for an Account

[](#getting-all-downloads-for-an-account)

```
use FetchApp\API\FetchApp;

// Create a new FetchApp instance
$fetch = new FetchApp();

// Set the Authentication data (needed for all requests)
$fetch->setAuthenticationKey("demokey");
$fetch->setAuthenticationToken("demotoken");;
try{
    // Let's grab our Downloads!
    $downloads = $fetch->getDownloads(); // Grabs all downloads
                    // or
    $downloads = $fetch->getDownloads(50, 4); // Grabs downloads, 50 per page, page 4.
}
catch (Exception $e){
    // This will occur on any call if the AuthenticationKey and AuthenticationToken are not set.
    echo $e->getMessage();
}
```

Getting File Information
------------------------

[](#getting-file-information)

### Getting All Files for an Account

[](#getting-all-files-for-an-account)

```
use FetchApp\API\FetchApp;

// Create a new FetchApp instance
$fetch = new FetchApp();

// Set the Authentication data (needed for all requests)
$fetch->setAuthenticationKey("demokey");
$fetch->setAuthenticationToken("demotoken");;
try{
    // Let's grab our Files!
    $files = $fetch->getFiles(); // Grabs all files
                    // or
    $files = $fetch->getFiles(50, 4); // Grabs files, 50 per page, page 4.
}
catch (Exception $e){
    // This will occur on any call if the AuthenticationKey and AuthenticationToken are not set.
    echo $e->getMessage();
}
```

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity25

Early-stage or recently created project

 Bus Factor1

Top contributor holds 50.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/b65777d59677c149df707f9a6e151b124cb31b0e483985d2f218d37ee6a0e814?d=identicon)[prcapps](/maintainers/prcapps)

---

Top Contributors

[![conantp](https://avatars.githubusercontent.com/u/539960?v=4)](https://github.com/conantp "conantp (48 commits)")[![brennydoogles](https://avatars.githubusercontent.com/u/1466280?v=4)](https://github.com/brennydoogles "brennydoogles (35 commits)")[![sparkweb](https://avatars.githubusercontent.com/u/1682258?v=4)](https://github.com/sparkweb "sparkweb (4 commits)")[![inkysplat](https://avatars.githubusercontent.com/u/799909?v=4)](https://github.com/inkysplat "inkysplat (3 commits)")[![mikelarkin](https://avatars.githubusercontent.com/u/18441?v=4)](https://github.com/mikelarkin "mikelarkin (3 commits)")[![themgt](https://avatars.githubusercontent.com/u/254128?v=4)](https://github.com/themgt "themgt (2 commits)")

### Embed Badge

![Health badge](/badges/fetchapp-fetchapp/health.svg)

```
[![Health](https://phpackages.com/badges/fetchapp-fetchapp/health.svg)](https://phpackages.com/packages/fetchapp-fetchapp)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
