Google-Drive based DMS Symfony

by polypodes


Google Drive based DMS (atop Symfony2)

A proof of concept for a Google Drive based document management system (DMS)

Inspired from genj/GenjGoogleDriveBundle




1/3 Setup Google API Client App credentials

To consume the Google Drive API, you need to follow this steps in Google Developers Console (GDC):

  • Create a Google Drive API Project on Google Developers Console (GDC)
  • Activate Google Drive API (status: ON) in GDC > API & auth > APIs
  • Generate a Service Account application type OAuth Client ID in GDC > API & auth > Credentials
  • Download a .p12 key file, via the same API Credentials form in GDC, to be then renamed as ServiceAccountAPIKey.p12

2/3 Symfony2 App configuration

You need to configure your app using this informations you just obtained from Google API Console:

  • Service account API key file: the ServiceAccountAPIKey.p12, generated above, pasted in the app/config/ folder
  • Service account e-mail address: a long e-mail address, generated above by Google API Console while creating your OAuth Credentials Client ID.

Add these to your parameters.yml:


3/3 Installation:

$~: git clone
$~: cd GoogleDrive-based-DMS
$~: make
$~: make install

API documentation generation (with RAML & NPM)

npm install -g raml2html
raml2html api.raml > build/API.html
[open/xdg-open] build/API.html


  • Use / Create a Google Drive User Account
  • In the Google Drive web interface, (right-click)share a file or an entire folder with the same email address used to fill dms.service_account_email above.

Then open the /files route URL in a browser to see, view & download filesize, filetype & thubmnail of each file & folder.

VPS deployement

ssh login@production
cd current_release
make deploy

Hackin' & Slashin'

You may want to temporary avoid the OAuth login/authorize process while you're developing new features: Just comment these lines at the very end of app/config/security.yml

#     Commenting these lines below = DISABLING login process & security controls
#        - { path: ^/api, roles: ROLE_USER }
#        - { path: ^/files, roles: ROLE_USER }


Set up front-end 'stuff'

cd integration
bower install
npm install

Heroku deployment

One-click way:


Manual way:

see and

heroku config:set SYMFONY_ENV=prod
git push heroku master

To push a branch other than master, use this syntax:

git push heroku yourbranch:master

Set up Heroku parameters

Method: a Composer script hadling your ignored parameter file

ServiceAccounAPIKey.p12 file:

Log in using heroku run bash and use curl to deploy manually the ServiceAccountAPIKey.p12 from a remote server

Alternative solution

Heroku debug

Heroku allows you to run commands in a one-off dyno with heroku run. Use this for scripts and applications that only need to be executed when needed, or to launch an interactive PHP shell attached to your local terminal for experimenting in you app’s environment:

$ heroku run "php -a"
Running `php -a` attached to terminal... up, run.8081
Interactive shell
php > echo PHP_VERSION;

For debugging purposes, e.g. to examine the state of your application after a deploy, you can use heroku run bash for a full shell into a one-off dyno. But remember that this will not connect you to one of the web dynos that may be running at the same time!


ex: vast-temple-3501


There is a lot to do ! See

License & Copyright

(c) 2015 Les Polypodes

Licence: MIT

Made in Nantes, France by Les Polypodes