phpapicomposer-phpgoogle-shopping-api

Google API Client Libraries PHP - Remove unnecessary folders and files


I just follow the instructions provided by google team, to communicate with the shopping API:

https://developers.google.com/api-client-library/php/auth/service-accounts

Everything works fine, I complete my integration (API for Shopping), nevertheless I realise now that when I download this google library, using composer:

composer require google/apiclient:^2.0

I have now around 6300 files to commit!!!

So, I will like to try to remove what for sure I will not need, since I just use API for google Shopping. This is my current vendor/ ( or lib/) folders structures:

enter image description here

This a sample of my code that is already working correctly:

require_once __DIR__.'/lib/autoload.php';

$client = new Google_Client();
putenv('GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json');
$client->useApplicationDefaultCredentials();
$client->setScopes('https://www.googleapis.com/auth/content');
$client->fetchAccessTokenWithAssertion();

$service = new Google_Service_ShoppingContent($client);

Even I never use some of features directly located in other folders (ex: monolog, etc), I'm not sure if they are or not necessary (I suppose not) for google api.

So I will like to have confirmation, of the folders that could be removed safely and everything that allow google api shopping works correctly are not affected.


Solution

  • All of those files are required dependencies of the google API project. You should never commit composer's vendor directory into your VCS repository. You should utilize the feature of your VCS for ignoring files/directories to prevent you from accidentally committing those dependency files.