Download the PHP package ondram/simple-google-reader without Composer

On this page you can find all versions of the php package ondram/simple-google-reader. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package simple-google-reader

Simple Google Spreadsheets and Docs Reader

Latest Stable Version Coverage Status GitHub Actions Build Status

PHP library providing a simple way to load data from Google Spreadsheets and Google Docs.

The aim is to provide universal low-level access to the data, without any additional features like data manipulation or formatting. It means you can implement any domain object mapping or data processing in your application.

This library is a wrapper for google/apiclient, with minimal additional dependency footprint. It is intended to be easily integrated to any framework or pure PHP.

Installation

Install using Composer:

Usage

  1. Obtain service account credentials for your project
  2. In service account details in IAM admin console open Keys settings and add JSON keys. Download generated JSON file with credentials (save for example as google_client.json).
  3. Optional: You can setup domain-wide delegation access for the service account. This is done in Google Workspace Admin. In that case the service account can impersonate any domain user.
  4. Enable required APIs in Google Cloud Console for your project:
  5. Share the intended document with your service account (or if you use domain-wide delegation, then with some user account), copy document ID (from the URL)
  6. Make sure to install any package implementing PSR-6 caching
  7. Prepare cache and initialize Google Client:

Reading spreadsheets

In Google Cloud Console, do not forget to enable Google Sheets API.

For spreadsheets, it is required that the first row contains column names. The library will use these names (converted to slugs) as keys in the associative array. Consider table:

First column Second column
Value 1 Foo
Value 2 Bar

This will be read as:

Empty rows are skipped. There is currently (intentional) limitation to read columns A:Z only.

Reading documents

As plaintext

In Google Cloud Console, do not forget to enable Google Docs API.

This will read the whole document as plain text. Only text elements are included, other elements like tables are ignored. Also, any document formatting is ignored.

As HTML

To read document as HTML, do not forget to enable Google Drive API in Google Cloud console.

Note the output will be quite bloated-HTML, with many inline styles and nested elements. It may be useful to apply on the output some HTML sanitizer like symfony/html-sanitizer to remove unwanted elements and attributes.

Testing

Tests in this library are mainly integration, meaning they require real Google API access. To run them, you must download and store JSON credentials for you service account to tests/google_client.json file.

The tests then use this table and this document to read example data.

Changelog

For latest changes see Semantic Versioning.


All versions of simple-google-reader with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
cocur/slugify Version ^4.3
google/apiclient Version ^2.13
psr/simple-cache Version ^1.0
psr/simple-cache-implementation Version ^1.0 || ^2.0 || ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ondram/simple-google-reader contains the following files

Loading the files please wait ....