PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, January 29, 2022

[FIXED] Git Module Subtree Composer Best Pratice in Yii2

 January 29, 2022     composer-php, git, module, php, yii2     No comments   

Issue

If I want to create a module inside the vendor folder, what are the git commands to create a subtree (or somehting else)?

Scenario: I update the module Push it to github

My colleague wants the update too, should he pull from github, or just update composer? Then he has to make his own changes and push them too github

I tried some solutions but I felt like they where not the best, how does everybody else do this?

Scenario: I want to override some view files from an existing module and create my own module for this (yes it has to be a module), extending from the original module Do I need extra steps for this? And a separate composer package? How can my colleague install this module and make some changes?


Solution

If you want the module to be accessible to everybody the easiest way to do this is to create a composer package for it. Then you just add it to the composer.json file and you can both use the package just by doing a composer update.

Remember to tie the git repository to packagist (through webhooks, when you create the packagist package you will see instructions), so each time you update git, an update to packagist will be available.

To push an update the module just browse to that particular path and do a commit / push to git like any other package.

If you do not want to create a packagist package, then you can always create a repository like this in composer.json Use PHP composer to clone git repo.



Answered By - Mihai P.
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing