Unleash the power of Redash.io APIs in your Laravel applications. This package allows you to easily extract, analyze, and leverage your data directly within your application. Transform your data management today!
- Queries: Easily create, edit, or archive query objects directly from your Laravel application. The package returns paginated arrays of query objects and supports the extraction of individual query objects too.
- Query Results: Initiate a new query execution or return a cached result effortlessly. Handle parameterized queries and manage max_age for cache bypassing with provided methods.
- Dashboards: Create, edit, or archive dashboard objects seamlessly. Fetch an array of dashboard objects or individual ones directly from your Laravel application.
- Jobs: Monitor the status of your query tasks effectively.
- You can install the package via composer:
composer require igorsgm/laravel-redash
- You can publish the config file with:
php artisan vendor:publish --tag="laravel-redash-config"
REDASH_BASE_URL=foo:bar
REDASH_API_KEY=12345678900987654321
- Redash API Documentation: https://redash.io/help/user-guide/integrations-and-api/api
Resource | Methods |
---|---|
Redash::queries() | all, get, create, update, delete, getCachedResult, executeOrGetResult, getResult |
Redash::queryResults() | get |
Redash::dashboards() | all, get, create, update, delete |
Redash::jobs() | get |
// Returns a paginated array of query objects.
Redash::queries()->all();
// Returns an individual query object.
Redash::queries()->get($queryId);
// Create a new query object.
Redash::queries()->create([
'name' => 'My Query',
'data_source_id' => 1,
'query' => 'SELECT * FROM table',
'description' => 'My Query Description',
// ...
]);
// Edit an existing query object.
Redash::queries()->update($queryId, [
'name' => 'My New Query Name',
// ...
]);
// Archive an existing query.
Redash::queries()->delete($queryId);
// Get a cached result for this query ID
Redash::queries()->getCachedResult($queryId);
// Initiates a new query execution or returns a cached result.
Redash::queries()->executeOrGetResult($queryId, [
'parameters' => [
'foo' => 'bar',
],
'max_age' => 0,
]);
- Execute a Query and return its result once ready (custom method).
// The maximum age (in milliseconds) of a cached result that the method should return.
// If a cached result is older than this, a new query execution will begin.
// Set to `0` to always start a new execution.
$maxAge = 1800;
// The number of times to retry the query execution if it is still in progress.
$retryAttempts = 20;
Redash::queries()->getResult($queryId, [
'foo' => 'bar',
], $maxAge, $retryAttempts);
// Returns a query result
Redash::queryResults()->get($queryResultId);
Redash::dashboards()->all();
Redash::dashboards()->get($dashboardId);
Redash::dashboards()->create([
// ...
]);
Redash::dashboards()->update($dashboardId, [
// ...
]);
Redash::dashboards()->delete($dashboardId);
Redash::jobs()->get($jobId);
composer test
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.