Introduction to use composer and git for managing modules

I wrote several modules for ss4. but only locally without versioncontrol. now I realley want to get into it, but do not find the right breadcrumbs to get it all running.

First thing is that if try to get my module from it s github-repository with “composer require” it tells me, that it does not find a matching version. …

So how to declare that version?

As you can see, I m really at the beginning. Maybe somebody can link me a good Tutorial or something that bring s it all together.

Thanks in advance

If you just run composer require.... it will search packagist for the module you’re trying to install. If the module hasn’t been released there, it won’t be able to find it.

So, two choices:

  1. If you want to release your code so that it can be easily installed by anyone… get yourself a packagist account and submit your package. The composer command should then find it.

  2. You can tell composer to use a repository directly (instead of packagist). This is especially good for things you don’t want to widely distribute, or during testing / development.

For number 2, you need to add the repository as a source in your project’s composer.json file.
See here for details of what to add:
https://getcomposer.org/doc/05-repositories.md#vcs

1 Like