Publish standalone modules on GitHub
Edit on GitHubTo publish a module on GitHub, take the following steps.
Prerequisites
- Create a GitHub Account.
- Create a GitHub repository for your module. For instructions, see Create a repository.
Set up Git
-
Install Git.
-
Configure Git with your username and email address:
git config --global user.name "Your Name"
git config --global user.email "youremail@example.com"
Publish a third-party module on GitHub
- Go to your project directory and initialize a Git repository:
cd /path/to/your/project
git init
- Add your project files to Git:
git add .
- Commit your changes with a descriptive message:
git commit -m "Initial commit"
- Link the local repository to the GitHub repository you’ve created:
git remote add origin git@github.com:your-company-name/your-repository.git
- Push your code to GitHub:
git push -u origin main
Refresh your GitHub repository page to see your code published.
- Add the module to your project’s
composer.json
:
composer config repositories.your-company-name/your-repository git git@github.com:your-company-name/your-repository.git
composer require your-company-name/your-repository:dev-main
Once the module is published on Packagist, the `repositories` section can be removed from `composer.json`.
Now the module is published GitHub.
Next step
Thank you!
For submitting the form