Folder Structure for App Engine using PHP to Set Up the Drive API -
the google documentation example setting google drive api work php, has require statements this:
<?php require_once 'google-api-php-client/src/google_client.php'; require_once 'google-api-php-client/src/contrib/google_driveservice.php'; other code ?> i downloaded .zip file github, , extracted it. in extracted folders , files, google-api-php-client files github, not contain file named google_client.php. there file named, client.php in src/google/ directory.
and there no contrib folder either.
and, there no file named driveservice.php in download of github google-api-php-client files.
so, i'm assuming references files , folders should this:
<?php require_once 'google-api-php-client/src/google/client.php'; require_once 'google-api-php-client/src/google/drive.php'; other code ?> the client.php file contains require_once statement, autoload.php file:
if (!class_exists('google_client')) { require_once dirname(__file__) . '/../autoload.php'; } the double dots in reference /../ indicates when file autoload.php being searched in order include, go parent folder, , search there.
so folder structure should be:
src - folder autoload.php google - folder client.php driveservice.php the autoload.php file code is:
<?php function google_api_php_client_autoload($classname) { $classpath = explode('_', $classname); if ($classpath[0] != 'google') { return; } // drop 'google', , maximum class file path depth in project 3. $classpath = array_slice($classpath, 1, 2); $filepath = dirname(__file__) . '/' . implode('/', $classpath) . '.php'; if (file_exists($filepath)) { require_once($filepath); } } spl_autoload_register('google_api_php_client_autoload'); the drive.php file has no require or include statements in it.
there service folder in downloaded files, , there service.php file in google folder.
is documentation wrong, , suggestion right? correct set drive api in php?
the folder structure zip file github different folder structure of files , folders obtained subversion. when google api php client library downloaded subversion, there contrib folder, , there files named google_client.php , google_driveservice.php. had downloaded , extracted files github zip file. creates different outcome downloading files subversion. subversion renames files guess, , creates different folder names. so, new download of folders , files using subversion, folder structure , file names confer example in documentation.
from getting started page in old documentation:
https://code.google.com/p/google-api-php-client/wiki/gettingstarted
i found info:
after extracting library . . . . . , have new google-api-php-client-x.y directory. library files in google-api-php-client/src directory
so, need end a:
google-api-php-client directory, , a:
google-api-php-client/src directory.
quote:
after obtaining library . . , have directory named google-api-php-client somewhere on file system, containing library files. specifically, need include file src/google_client.php , src/contrib/google_plusservice.php inside of scripts.
the above quote google_plusservice.php replace whatever api service file need use.
there multiple ways include needed library files code.
it seems there change in naming conventions of files , folders explained in documentation migrating new library version.
https://developers.google.com/api-client-library/php/guide/migration
before drive api can used, authorization needs take place. initial documentation looking @ command line application. don't want command line application, i'm trying build web application. so, server side authorization needs implemented first.
https://developers.google.com/drive/web/auth/web-server
the server side authorization needs additional php file included code.
require_once "google-api-php-client/src/google/service/oauth2.php"; the documentation here:
Comments
Post a Comment