Thinq PHP API
PHP Library Intended to Interact with Thinq's API
composer require dutchie027/thinq
// 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); ...
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_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).
The library has the following classes:
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);
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.
||string||The directory where the log file is stored||sys_get_temp_dir()|
||string||The name of the log file that is created in
||6 random characters + time() + .log|
||string||If you share this log file with other applications, this is the tag used in the log file||
||string||The level of logging the application will do. This must be either
- 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...
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.