
I have only one routes <strong>app/routes.php</strong>, I am using <strong>git /git-hub</strong> for sharing my projects with some developers. Cause they can work together. But problem is that : every one using same <strong>routes.php</strong> file for routing and when they <strong>push/pull</strong> in git this <strong>routes.php</strong> file conflicts all the time.
Is there any way to set routes for different developer in same project ?
Answer1:
There is a silly way but fruitful::
<ol> <li>create routes_demo.php :: here demo developer can work </li> <li>Include routes_demo.php in your main routes.php</li> </ol>include more as your need. Enjoy sharing codes /projects.
THanks
Answer2:
This is what Github is all about - collaboration between multiple developers.
There are many ways to handle this - but in general each developer can fork his own branch - make changes - then merge them back in.
You will expect conflicts on the file - but the conflicts should not be the same route - it should be different routes in the same file - so you can merge the conflict into the one route file
Answer3:
I suggest you use controllers to define routing logic, so your routes.php file does not get complicated. You will avoid a lot of conflicts this way. You can read more here. Pasting an excerpt:
Instead of defining all of your route-level logic in a single routes.php file, you may wish to organize this behavior using Controller classes. Controllers can group related route logic into a class, as well as take advantage of more advanced framework features such as automatic dependency injection.