A Laravel package that allows you to interact with Tableau Server and Tableau Cloud's APIs. This package provides a simple and flexible interface for interacting with the following APIs:
- REST API
- Metadata API not yet implemented
- VizQL Data Service not yet implemented
- Laravel 10.x or higher
- PHP 8.2 or higher
- Composer
You can install the package via composer:
composer require interworks/laravel-tableau
You can publish the config file with:
php artisan vendor:publish --tag="laravel-tableau-config"
This is the contents of the published config file:
return [
'url' => env('TABLEAU_URL', 'https://your-tableau-server.com'),
'site_name' => env('TABLEAU_SITE_NAME', ''),
'product_version' => env('TABLEAU_PRODUCT_VERSION'),
'credentials' => [
'username' => env('TABLEAU_USERNAME', ''),
'password' => env('TABLEAU_PASSWORD', ''),
'site_id' => env('TABLEAU_SITE_ID', '')
],
'token_name' => env('TABLEAU_TOKEN_NAME', ''),
];
NOTE: The product_version
is not required, but will make an additional GET
request prior to authorization. For
performance considerations, either configure your product_version prior to initializing a new TableauAPI() class, or
enter it into your published config file.
Initialize the API
use InterWorks\Tableau\TableauAPI;
$tableau = new TableauAPI();
Alternatively, you can override configuration dynamically if needed:
Config::set('tableau.server_url', 'https://my-new-server-url.com');
Config::set('tableau.credentials.pat_name', 'new_server_pat_name');
Config::set('tableau.credentials.pat_secret', 'new_server_pat_secret');
$tableau = new TableauAPI();
You don't need to manually authenticate. The TableauAPI
class automatically manages authentication tokens and reuses
them as long as they remain valid.
composer test
Please see CHANGELOG for more information on what has changed recently.
Contributing
Feel free to fork this repository and submit pull requests. Make sure to add tests for new features or changes.
- Fork the repository.
- Create your feature branch (git checkout -b feature/my-new-feature).
- Commit your changes (git commit -am 'Add some feature').
- Push to the branch (git push origin feature/my-new-feature).
- Open a pull request.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.