G
G
grabbee2016-09-26 12:57:04
PHP
grabbee, 2016-09-26 12:57:04

How to properly split a php/js project?

Hello. Can you please tell me how to properly break the project into parts for more flexible development? After all, you can select individual services in the php code and compile them into a separate GIT repository, then compile composerom or build a git-submodule (which I haven’t understood yet, but they write that submodules are not good).
Further more. PHP module-services can be allocated to the /vendor/company/modulename folder, for example. Why, in addition to git-config files, add composer.json (lock) at the root. Now JS
1. Included files/libraries - controlled by bower
If I just need to include a lib in html code, I just create a config file for bower and install dependencies, then manually write a link to the bower folder in the right place.
Question- And if I extract my lib from my JS code, will I have to, for example, put it on GitHub or put my Git server? Download via bower and assemble/glue via grunt, right?
2. Grunt needs npm packages, so in the main project at the root, in addition to composer.json, bower.json, I also need package.json for npm - all these configs will go to the main git repository of the project, right?
3. ES6/7 allow you to build JS from modules as separate files. Then they somehow need to be collected into one file for the client, but how to do it? grunt-babel will work?
---
Tell me, architecturally CSS-less sources, JS modules and libraries that are directly linked to PHP code - should I keep them in the main repository or somehow I can take them out. Yet again. It turns out that after editing css, in order to somehow see the changes (it’s not in the main repository, but as a separate project), I will need to transfer the compiled css to the main repository and only after that see everything ?.
And the deployment of all this ... Help with advice please. Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Evgenievich, 2016-09-26
@grabbee

It is necessary to split the project into separate modules, but there is no need to create a repository for each separate module. In the future, if you are sure that the modules can live their own lives, you can move them to a separate repository with tests and separate documentation.
The same goes for JS code. First, you do everything in one, for your project, after that, if you are sure that the module is reusable, move it to a separate repository.
2. yes.
3. will do, you can also look towards webpack.
--
Do you have SPA or not? If not, do everything in one repository. If SPA can be divided into two - front and backend.
You can use PHPCI for deployment .
In general, how many people and what kind of technologists will be on the project?

G
grabbee, 2017-01-31
@grabbee

I use git submodules for everything :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question