Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: reduce vendor libraries #1624

Open
rezzorix opened this issue Dec 1, 2024 · 3 comments
Open

Suggestion: reduce vendor libraries #1624

rezzorix opened this issue Dec 1, 2024 · 3 comments

Comments

@rezzorix
Copy link

rezzorix commented Dec 1, 2024

Would it be possible to reduce the size of the vendor folder?

Right now, the folder has over 26,000 files.
There are more than 25,000 files in Google apiclient-services alone (vendor\google\apiclient-services\src)

This includes APIs like Google Play and YouTube, which don’t seem necessary for EasyAppointments.

Could unused libraries be excluded or removed automatically during the build process?
This would make the project lighter and easier to deploy.

Thanks for considering this!

@alextselegidis
Copy link
Owner

Hello!

Thanks for submitting this ticket.

It is true that the Google Library is massive.

We'll check and see how this could become smaller.

Alex Tselegidis, Easy!Appointments Creator
Need a customization? Get a free quote!

@rezzorix
Copy link
Author

rezzorix commented Dec 5, 2024

The Readme of Google APIs Client Library for PHP has a section about Cleaning up unused services

Cleaning up unused services

There are over 200 Google API services. The chances are good that you will not
want them all. In order to avoid shipping these dependencies with your code,
you can run the Google\Task\Composer::cleanup task and specify the services
you want to keep in composer.json:

{
    "require": {
        "google/apiclient": "^2.15.0"
    },
    "scripts": {
        "pre-autoload-dump": "Google\\Task\\Composer::cleanup"
    },
    "extra": {
        "google/apiclient-services": [
            "Drive",
            "YouTube"
        ]
    }
}

This example will remove all services other than "Drive" and "YouTube" when
composer update or a fresh composer install is run.

IMPORTANT: If you add any services back in composer.json, you will need to
remove the vendor/google/apiclient-services directory explicitly for the
change you made to have effect:

rm -r vendor/google/apiclient-services
composer update

NOTE: This command performs an exact match on the service name, so to keep
YouTubeReporting and YouTubeAnalytics as well, you'd need to add each of
them explicitly:

{
    "extra": {
        "google/apiclient-services": [
            "Drive",
            "YouTube",
            "YouTubeAnalytics",
            "YouTubeReporting"
        ]
    }
}

Should be fairly simple to add only what is needed...
I manually deleted most of the services in the folder.
Not sure if each of the services is standalone by itself, or if there are inter-dependencies.
Logic tells me they should be standalone, so that should make inclusion/exclusion even easier.

@alextselegidis
Copy link
Owner

Hello!

Thanks for researching and providing a suggestion for this optimization.

This is really helpful :)

Will review and update accordingly.

Alex Tselegidis, Easy!Appointments Creator
Need a customization? Get a free quote!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants