Backend Development 4 min read

Installing Composer on Windows, Creating a PHP SDK Package, and Publishing It to Packagist

This guide walks through installing Composer on Windows, configuring a Chinese mirror, creating a PHP SDK package with Composer, publishing the package to GitHub and Packagist, and finally installing and using the package locally and on a server.

Laravel Tech Community
Laravel Tech Community
Laravel Tech Community
Installing Composer on Windows, Creating a PHP SDK Package, and Publishing It to Packagist

1. Install Composer – Download Composer-Setup.exe and run it on Windows.

2. Change Composer repository mirror – Open a CMD window, navigate to the Composer installation directory, and run the following command to use the Aliyun mirror:

composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/

3. Create a package directory – Create a folder named zzyc , then inside it run composer init to generate a composer.json file.

4. Write the package code – Implement the PHP SDK that wraps about 30 API interfaces.

5. Publish the code to GitHub – Create a new repository (e.g., zzyc-supply/php-sdk ) and push the code, then tag a release.

6. Submit the package to Packagist – Visit Packagist , log in with GitHub, click Submit , enter the GitHub repository URL, and check the package.

7. Verify submission – Search the package on Packagist to confirm it appears.

8. Install the package locally – Run composer require zzyc-supply/php-sdk , then inspect the installed files and test the SDK with php examples/goods.php to fetch product data.

9. Install the package on a production server (e.g., using Baota panel) – Add "zzyc-supply/php-sdk": "^1.0" to the project's composer.json , delete composer.lock , and install dependencies through the panel.

10. Confirm the package works in the project – Verify the SDK classes are available and can be used as expected.

Note: This tutorial is compiled from online sources; any copyright issues should be addressed.

backendPHPwindowsTutorialComposerpackagepackagist
Laravel Tech Community
Written by

Laravel Tech Community

Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.