-
-
Notifications
You must be signed in to change notification settings - Fork 431
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
Composer pulling in 11MBs of unneccesary Google Services libraries #74
Comments
Hi @MichaelPote and thanks for reaching out! I see that you are referring to release 1.x of the library. Starting with 2.x, the library only requires Extracting the I do agree that using the rather big dependency is not optimal, but if the firebase-php library is not the only dependency you have in your project, there are certainly some overlaps. Of course I do understand if this is not an option for you. I will see what I can do, but unfortunately I can't promise you a change - I should have mentioned in the 1.x branch that this version will only receive bugfix updates (similar to PHP 5.6), and it already doesn't provide all the features that are present in the 2.x branch. If you'd like to propose a Pull Request to the 1.x branch that reduces the total size, I will definitely have a serious look at it. Unfortunately I can't recommend another Firebase library with a smaller footprint, as I don't know one that provides Service Account based authentication. |
Hi @jeromegamez, thanks very much for the reply. I'd love to use the 2.x branch of firebase-php but I'm building a WordPress plugin and I unfortunately cant bank on people being able to run PHP 7. How much work is it to convert the v1.x branch to also only use the |
Some background: I initially included the Using But after your issue, I will certainly look more at this in the future. |
I will have a look at it this evening and let you know if I can figure something out! |
Awesome, thanks @jeromegamez! |
After having looked at it, I have realized that I wouldn't be able to release a new version implementing a possible solution 🙁 - here's the thing: the Firebase Configuration Interface defines two public methods I honestly don't think that developers implementing the 1.x version are actually using those methods, but the possibility does exist, and removing those methods or changing their signature would violate SemVer and put existing projects at risk. I'm sorry that I can't help you more - on the bright side, as the 1.x branch will not change considerably in the the future, you should be safe to create a fork and implement the changes to reduce the size there (and become the only PHP 5.x Firebase library with active support 🙂). I will close the issue now, but want to make clear that this doesn't mean I want to end the conversation here. Please feel welcome to add more comments or to join the #php channel in the Firebase Community Slack, where you will find me and other PHP developers working with Firebase. |
@jeromegamez Thanks very much for looking into it. I understand the need to keep the library backward compatible. I'll look into forking it and implementing this and a couple other changes I've made to the codebase. Thanks again! |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
As far as I can see, Firebase-php requires the google/apiclient composer library just so that it can use the authentication routines inside the Google_Client() class. Unfortunately the google/apiclient library insists on requiring the google/apiclient-services library which constitutes over 5000 extra php includes and 11.4 MB of code. It does not seem like this code is ever used.
Unfortunately distributing Firebase-php inside my project with all this extra bloat is just not feasible, so I went into composer's autoload.php files and manually commented out the 5089 Google_Service_* classes from being included in the project and I was able to authenticate with my Firebase project and read and write to my Firebase database just fine.
The only solution I can think of would be to suggest that Firebase-php extract just the Google_Client() class out of the google/apiclient package to drastically reduce the code footprint required to use the library. Any other ideas are welcome?
The text was updated successfully, but these errors were encountered: