How to organize the site structure in PHP?


I am writing a site in PHP using Composer, NPM (with modules like Moment.js etc.) and Webpack, I plan also to write unit tests for PHP code, I am planning to finish part of the front end on Vue.js.
In the bowels of back-end'a plows to the engine, which is fed to the templates from a separate folder.
The source code uploaded to Bitbucket, all changes to the site to download manually from your computer.
Website is not a SPA, almost without API.
Now the site looks like this (folder node_modules and vendor added .gitignore, so that on the screenshot they are not):
All the code in the JS is inside of folder templates.

I would like to separate PHP and JS source code, tests, templates for the templating engine, and that in the end collects Webpack and what's on the website.

Tell me, please, how correctly to organize the structure of your site?
Thanks in advance!
June 8th 19 at 17:14
2 answers
June 8th 19 at 17:16
Thank you all for the tips! Of course, to do everything "for science" will not work, because the site has no single point of entry and front-end generates PHP, but the basic ideas I understand.
June 8th 19 at 17:18
I do things like this
in the project folder I have a folder www inside the frontend or it is a package.json and here is the entire frontend of the website
also there is a folder api or backend within it lies the composer.json and everything with regard to backend
the backend usually vyneseno for subdomain api.project and front available the primary path
for isolation of the environments I use vagrant or docker or anything, the config is at the root of the project and are scripts which can deploy the environment again.
start the development environment
vagrant up // or Docker or any other virtualization
cd frontend
npm run dev

deployment is a little different but also quite simple
Thank you!
So all separate for me, unfortunately, not an option, because the front is generated from templates using PHP. - Zola_Johnson commented on June 8th 19 at 17:21

Find more questions by tags PHPWebpack