PHP Classes
elePHPant
Icontem

File: manual.txt

Recommend this page to a friend!
  Classes of Dave Smith  >  USDA PHP Nutritional Products Database Wrapper  >  manual.txt  >  Download  
File: manual.txt
Role: Documentation
Content type: text/plain
Description: Documentation
Class: USDA PHP Nutritional Products Database Wrapper
Retrieve nutritional data from USDA database
Author: By
Last change:
Date: 4 years ago
Size: 1,591 bytes
 

 

Contents

Class file image Download
Class: ndbwrap
Version: 0.1 beta 10/1/2015

Copyright 2015 Wagon Trader, All Rights Reserved


Description:

This class will retrieve nutritional information for food from the USDA Nutritional Database.


Files:

ndbwrap.class.php - Main class

example.food.php - example to request and display food information

example.list.php - example to request and display data lists

example.nutrient.php - example to request and display specific nutritional information for foods

example.search.php - example to search and display foods that match keywords query


Installation:

Upload files to a web accessible location on your server (eg. public_html)


Configuration:

For testing, you can use the supplied API key 'DEMO_KEY'. If you are going to use this class in production
you will need to get you own API key available at http://ndb.nal.usda.gov/ndb/api/doc (select sign up now in
Gaining Access section)

You can change the following settings in the class to meet your specific needs...

$datagovKey - Your data.gov API key.

$ndbFormat - format of request results. Currently only JSON is supported so you should not change this value

$USDAcitation - Recommended citation from the USDA. The USDA data is in the public domain, so there are no
    restrictions for using it, however this citation is the official text for the source.

$dbDomain - URL to REST API. You should only need to change this if the USDA changes their API location.


Usage:

Refer to example files for usage examples.

Refer to ndbwrap.class.php file for instructions on using methods

Changelog

0.1

beta release