When using ‘composer require square/square’ I always get these errors:
Could not fetch https://api.github.com/repos/apimatic/unirest-php/zipball/, please review your configured GitHub OAuth token or enter a new one to access private repos
I have a valid non-expired Personal access token (classic)
Is there another way to retrieve the square-php-sdk, including its dependent libraries and packages, without having to rely on the cumbersome composer? Why does the square-php-sdk even rely on non-public private dependent repositories in the first place?
I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:
Additional Documentation
OAuth API
OAuth API
Access Tokens and Other Credentials
If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.
The error you’re encountering is related to accessing a private repository on GitHub, which typically requires a valid GitHub OAuth token. However, the Square PHP SDK and its dependencies should not rely on private repositories. The issue might be due to a misconfiguration or an outdated dependency that incorrectly points to a private repository.
To address this, you can try the following steps:
-
Check Composer Configuration: Ensure that your Composer configuration is correct and that your GitHub OAuth token is properly set up. You can configure your GitHub token in Composer by running composer config --global github-oauth.github.com <your-token>.
-
Clear Composer Cache: Sometimes, clearing the Composer cache can resolve issues with fetching packages. You can do this by running composer clear-cache.
-
Update Composer: Make sure you are using the latest version of Composer. You can update Composer by running composer self-update.
-
Direct Download: If you prefer not to use Composer, you can manually download the Square PHP SDK from its GitHub repository. You can then include the SDK in your project manually. However, this approach requires you to manage dependencies and updates manually, which can be cumbersome.
-
Check for Updates: Ensure that you are using the latest version of the Square PHP SDK. Sometimes, issues are resolved in newer releases.
If the problem persists, it might be worth checking the specific dependencies in your composer.json file to ensure none are pointing to private repositories. If you suspect a specific dependency is causing the issue, you can try reaching out to the maintainers of that package for further assistance.
This answer was reviewed by @Bryan-Square.
Thank you for your reply. It looks like the problematic apimatic package is now fixed, and composer doesn’t complain anymore.