2017 © Pedro Peláez
 

library laravel-googleforms

Laravel client for Google Forms

image

akaramires/laravel-googleforms

Laravel client for Google Forms

  • Monday, May 16, 2016
  • by akaramires
  • Repository
  • 1 Watchers
  • 4 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 1 Open issues
  • 1 Versions
  • 33 % Grown

The README.md

Laravel 5 Google Forms (using Google Scripts) - Pull requests are welcome!

Installation

Installation using composer:, (*1)

composer require akaramires/laravel-googleforms

Configuration

Google oauth key

1) Go to https://console.cloud.google.com and create OAuth client ID:\ Screenshot: https://monosnap.com/direct/AvY7Ks2vmUtWkCS2mD8Eukgp3Ad8We, (*2)

2) Download and save the file into storage/ directory and with name google_client_secret.json \ Screenshot: https://monosnap.com/direct/OnXeCqQi2UolBrunMLvt5oGK5jG7gv, (*3)

Laravel

1) Publish the package config file:, (*4)

php artisan vendor:publish --provider="Akaramires\GoogleForms\GoogleFormsServiceProvider"

2) Get access token, (*5)

php artisan google-forms:token

Google Scripts

  • Go to https://script.google.com
  • Create new project
  • Create 5 scripts (content of them you can find in vendor/akaramires/laravel-googleforms/scripts directory)
  • Click on Publish->Deploy as API executable
  • Copy API ID and paste into config/googleforms.php

Examples

Simple form

$form = App::make('GoogleForm');

$params = [
    'file_name'                   => sha1(microtime(true)),
    'file_description'            => 'File was created by ' . get_current_user() . ' (' . app()->environment() . ')',
    'title'                       => 'Super title',
    'description'                 => 'Super description',
    'confirmation_message'        => 'Your response has been recorded.',
    'show_progress'               => false,
    'limit_one_response_per_user' => false,
    'shuffle_questions'           => false,
    'show_link_to_respond_again'  => false,
    'publish_and_show'            => false,
    'allow_response_edits'        => false,
    'accepting_responses'         => true,
];

$form->createForm($params);

Form with fields

$fields = [];

$textItem = new TextItem();
// $textItem->setId($field->google_id); # if you have saved field id
$textItem->setTitle('Field title');
$textItem->setHelpText('Field help text');
$textItem->setRequired(true);
$textItem->setIndex(0);

$fields[] = $form->createOrUpdateElement($textItem, true);

$queries = [
    'form'   => $form->createForm($params, true),
    'fields' => $fields,
];

$request = $this->form->batchRequest($queries);;

print_r($request);

The Versions

16/05 2016

dev-master

9999999-dev

Laravel client for Google Forms

  Sources   Download

MIT

The Requires

 

The Development Requires

by Elmar Abdurayimov

api google scripts google forms