Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ttskch/pheetsu
PHP library to CRUDify Google Spreadsheets like sheetsu.com
https://github.com/ttskch/pheetsu
api crud google-sheets sheetsu spreadsheets
Last synced: 8 days ago
JSON representation
PHP library to CRUDify Google Spreadsheets like sheetsu.com
- Host: GitHub
- URL: https://github.com/ttskch/pheetsu
- Owner: ttskch
- License: mit
- Created: 2017-08-23T22:26:54.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-16T00:47:09.000Z (almost 6 years ago)
- Last Synced: 2024-04-17T23:47:09.277Z (7 months ago)
- Topics: api, crud, google-sheets, sheetsu, spreadsheets
- Language: PHP
- Homepage:
- Size: 24.4 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pheetsu
[![Latest Stable Version](https://poser.pugx.org/ttskch/pheetsu/v/stable)](https://packagist.org/packages/ttskch/pheetsu)
[![Total Downloads](https://poser.pugx.org/ttskch/pheetsu/downloads)](https://packagist.org/packages/ttskch/pheetsu)PHP library to CRUDify Google Spreadsheets like [sheetsu.com](https://sheetsu.com).
## Requirements
- PHP 5.6+
## Installations
```bash
$ composer require ttskch/pheetsu:@dev
```## Usage
If you have a Google Spreadsheet like [this](https://docs.google.com/spreadsheets/d/1JQkfd3dlyxFRuxIwGPnBnrxS-l-bLVw_BbHskxT9Nj4/edit#gid=0),
![image](https://user-images.githubusercontent.com/4360663/31042852-2c4fca34-a5ec-11e7-83e0-b048ed3fe3c8.png)
You can CRUD the spreadsheet via pheetsu so easily like below.
### Initializing with OAuth2
```php
$pheetsu = \Ttskch\Pheetsu\Factory\PheetsuFactory::createOAuth(
'google_oauth2_client_id',
'google_oauth2_client_secret',
'google_oauth2_redirect_uri',
'google_oauth2_javascript_origin',
'1JQkfd3dlyxFRuxIwGPnBnrxS-l-bLVw_BbHskxT9Nj4', // spreadsheet id
'demo' // sheet name
);// authenticate and be authorized with Google OAuth2.
$pheetsu->authenticate();
```### Initializing with Service Account
```php
$pheetsu = \Ttskch\Pheetsu\Factory\PheetsuFactory::createServiceAccount(
'/path/to/your/service-account-credentials.json',
'1JQkfd3dlyxFRuxIwGPnBnrxS-l-bLVw_BbHskxT9Nj4', // spreadsheet id
'demo' // sheet name
);
```### Using
```
$rows = $pheetsu->read();
var_dump($rows);// array (size=3)
// 0 =>
// array (size=3)
// 'id' => string '1' (length=1)
// 'name' => string 'Alice' (length=5)
// 'age' => string '20' (length=2)
// 1 =>
// array (size=3)
// 'id' => string '2' (length=1)
// 'name' => string 'Bob' (length=3)
// 'age' => string '25' (length=2)
// 2 =>
// array (size=3)
// 'id' => string '3' (length=1)
// 'name' => string 'Charlie' (length=7)
// 'age' => string '18' (length=2)
```See also [demo](demo).