Publish standalone modules on GitHub

Edit on GitHub

To publish a module on GitHub, take the following steps.

Prerequisites

Set up Git

  1. Install Git.

  2. 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

  1. Go to your project directory and initialize a Git repository:
cd /path/to/your/project
git init
  1. Add your project files to Git:
git add .
  1. Commit your changes with a descriptive message:
git commit -m "Initial commit"
  1. Link the local repository to the GitHub repository you’ve created:
git remote add origin git@github.com:your-company-name/your-repository.git
  1. Push your code to GitHub:
git push -u origin main

Refresh your GitHub repository page to see your code published.

  1. 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

Test the compatibility