Skip to content

tradecoverexchange/google-cloud-tasks-laravel

Repository files navigation

Google Cloud Tasks Queue Driver for Laravel

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

A Laravel Queue driver to interact with Google Cloud Tasks.

Installation

Requires Laravel 9 and PHP 8.1 as a minimum.

You can install the package via composer:

composer require tradecoverexchange/google-cloud-tasks-laravel

You can publish an overriding queue config file with:

php artisan vendor:publish --provider="TradeCoverExchange\GoogleCloudTaskLaravel\CloudTaskServiceProvider" --tag cloud-task-config --force

Or you can manually add the two following connections to your own queues.php config file:

return [
    'connections' => [
        'app_engine_tasks' => [
            'driver' => 'google_app_engine_cloud_tasks',
            'queue' => env('GOOGLE_CLOUD_TASKS_QUEUE', 'default'),
            'project_id' => env('GOOGLE_CLOUD_TASKS_PROJECT_ID', ''),
            'location' => env('GOOGLE_CLOUD_TASKS_LOCATION_ID', ''),
            'options' => [
                'credentials' => 'path/to/your/keyfile',
                'transport' => 'rest',
            ],
        ],

        'http_cloud_tasks' => [
            'driver' => 'google_http_cloud_tasks',
            'queue' => env('GOOGLE_CLOUD_TASKS_QUEUE', 'default'),
            'project_id' => env('GOOGLE_CLOUD_TASKS_PROJECT_ID', ''),
            'location' => env('GOOGLE_CLOUD_TASKS_LOCATION_ID', ''),
            'authentication' => [
                'token_type' => 'oidc',
                'service_account' => env('GOOGLE_CLOUD_TASKS_SERVICE_ACCOUNT', ''),
            ],
            'options' => [
                'credentials' => 'path/to/your/keyfile',
                'transport' => 'rest',
            ],
        ],
    ],
];

Usage

Usage of the package should primarily be done via the Laravel Queue system.

Missing Features

There is no ability to configure the worker options in the same way as a typical queue connection in Laravel.

For Http Tasks only the OIDC token type has been implemented for protecting the controller from fraudulent requests. We don't use OAuth ourselves but would be happy to include if someone makes a PR for it or knows how that mechanism should work compared to OIDC.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

About Us

Trade Cover Exchange

Trade Cover Exchange is a platform for insuring your trade with other companies, protecting you from instabilities in the supply chain.

We proudly use the Google Cloud platform for our service and hope to share more of our work with the developer community in the future.

Security

If you discover any security related issues, please email peter@tradecoverexchange.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

A Laravel Queue driver to interact with Google Cloud Tasks

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages