Step-by-step composer package Developing the package Create a composer.json file { "name": "your-user/package-name", "description": "Package Description", "type": "library", "require": { "php": ">=7.4" }, "autoload": { "psr-4": { "YourNamespace\\": "src/" } } } Create the src directory Publish in github Use and test locally in another local project In the another local project add in composer.json: { "repositories": [ { "type": "path", "url": "../path/to/your/package" } ], "require": { "your-user/package-name": "@dev" } } Execute composer update to install the package Register in Packagist Create an account Submit your package Packagist will sychronize with your repository Install your package with composer: composer require your-user/package-name Another way to use your package Github repository direct Add in composer.json: { "repositories": [ { "type": "vcs", "url": "https://github.com/your-user/package-name" } ], "require": { "your-user/package-name": "main" } } Execute composer update