atico / spreadsheet-translator-provider-googledrive
Spreadsheet Translator - Google Drive Provider with no authentication
Installs: 42
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/atico/spreadsheet-translator-provider-googledrive
Requires
- php: >=8.4
- guzzlehttp/guzzle: ^7.7
- samuelvi/spreadsheet-translator-core: ^1.0|^2.0|^8.0
Requires (Dev)
- phpunit/phpunit: ^12.4
- rector/rector: ^2.1
README
A Google Drive provider for Spreadsheet Translator that requires no authentication. This provider allows you to fetch translations directly from publicly accessible Google Spreadsheets.
Requirements
- PHP 8.4 or higher
- Composer
Installation
You can install the package via composer:
composer require samuelvi/spreadsheet-translator-provider-googledrive
Usage
Basic Example
<?php require_once __DIR__ . '/vendor/autoload.php'; use Atico\SpreadsheetTranslator\SpreadsheetTranslator; $spreadsheetTranslator = new SpreadsheetTranslator([ 'provider' => 'google_drive', 'source_resource' => 'https://docs.google.com/spreadsheets/d/YOUR_SPREADSHEET_ID/edit#gid=YOUR_SHEET_ID', ]); $translations = $spreadsheetTranslator->getTranslations('en');
Configuration Options
provider: Must be set to'google_drive'source_resource: The URL of your Google Spreadsheet (must be publicly accessible)format: Optional, defaults to'csv'temp_local_source_file: Optional, temporary file path for downloaded spreadsheet
Making Your Spreadsheet Public
For this provider to work, your Google Spreadsheet must be publicly accessible:
- Open your Google Spreadsheet
- Click on "Share" button
- Change to "Anyone with the link can view"
- Copy the spreadsheet URL
Development
Installation
make install
Running Tests
Run all tests:
make test
Run tests with coverage:
make test-coverage
Code Quality
Run Rector (dry-run to see changes):
make rector-dry
Apply Rector changes:
make rector
Validate composer.json:
make validate
Run all checks (validate, rector-dry, test):
make check
Available Make Commands
Run make help to see all available commands:
make help
Project Structure
.
├── src/
│ ├── GoogleDriveProvider.php # Main provider implementation
│ └── GoogleDriveConfigurationManager.php # Configuration management
├── tests/
│ ├── GoogleDriveProviderTest.php
│ └── GoogleDriveConfigurationManagerTest.php
├── .github/
│ └── workflows/
│ └── ci.yml # GitHub Actions CI configuration
├── composer.json
├── phpunit.xml # PHPUnit configuration
├── rector.php # Rector configuration for PHP 8.4
├── Makefile # Development commands
└── README.md
Testing
The package includes comprehensive unit tests. Run them with:
vendor/bin/phpunit
Or using make:
make test
Continuous Integration
This package uses GitHub Actions for continuous integration. The CI pipeline:
- Validates composer.json
- Installs dependencies
- Runs Rector checks
- Executes all tests
See .github/workflows/ci.yml for details.
License
The MIT License (MIT). Please see License File for more information.
Credits
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.