dutchie027/thinq

dev-main 2022-08-30 13:04 UTC

README

Latest Stable Version Total Downloads License CodeFactor

PHP Library Intended to Interact with Thinq's API

Installation

composer require dutchie027/thinq

Usage

// require the composer library
require_once ('vendor/autoload.php');

//make the connction to the API for use
$api = new dutchie027\Thinq\API(THINQ_USER, THINQ_TOKEN);

...

Requirements

The libarary assumes you have three defined variables:

define ('THINQ_USER', 'myUserName');
define ('THINQ_TOKEN', '867530986753098675309');
define ('THINQ_ACCOUNT_ID', '12345678');

in order to work properly. THINQ_USER and THINQ_TOKEN are fed to the API as parameters for login and header information. THINQ_ACCOUNT_ID is used in making URLs on the back end. These constants can be defined in your script or they can be imported or included in a constant file (preferred).

General Information

Class Listing

The library has the following classes:

Class Information

API

The main connection requires at minimum, a username and token.

Once you have a user and token, you can simply connect with it or you can add options

// Ensure we have the composer libraries
require_once ('vendor/autoload.php');

// Instantiate with defaults
$api = new dutchie027\Thinq\API(THINQ_USER, THINQ_TOKEN);

// Instantiate without defaults, this allows you to change things
// like log location, directory, the tag and possible future settings.
$settings = [
  'log_dir' => '/tmp',
  'log_name' => 'thinqi',
  'log_tag' => 'thinq-api',
  'log_level' => 'error'
];

$api = new dutchie027\Thinq\API(THINQ_USER, THINQ_TOKEN, $settings);

Settings

The default settings are fine, however you might want to override the defaults or use your own.NOTE: All settings are optional and you don't need to provide any.

To-Do

  • Bring in more of the function(s) from Thinq
  • Document the class(es) with proper doc blocks better
  • Clean up the code a bit more
  • Stuff I'm obviously missing...

Contributing

If you're having problems, spot a bug, or have a feature suggestion, file an issue. If you want, feel free to fork the package and make a pull request. This is a work in progresss as I get more info and further test the API.