T
T
tushev2015-11-26 15:18:56
PHP
tushev, 2015-11-26 15:18:56

How to use package managers? Composer, bower, other?

I want to make an opensource project meant to be embedded in other projects . Specifically, this is a kind of database editor with many forms and tabs, designed to be embedded inside all sorts of admins and cms. The project contains both PHP code and JavaScript+CSS+Images . In addition, the project has many dependencies on third-party libraries , both PHP (eg PHPMailer) and JavaScript (eg jQueryUI).
How to properly and optimally use package managers for such a task?
Composer puts everything in /vendor folders, both PHP and JavaScript. It seems to me that this is not correct, because. there is a risk that PHP files will become publicly available through the web server. Putting a lot of .htaccess files inside the vendor folder is also somehow not aesthetically pleasing.
Another option I see is to use a separate Composer for PHP, and a separate Bower for the rest. But it's somehow not convenient. You will have to use two different package managers in parallel.
Plus, I want other developers to be able to install my component in their project as simply as possible. Then the question is, where to place the PHP and JS files of my project itself? In /vendor and /bower_components?
My question is how to organize all this correctly, beautifully and conveniently?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
V
Vitaliy Orlov, 2015-11-26
@orlov0562

You're confused:
* composer is a backend dependency management thing
* bower is a frontend dependency management thing
keywords here "dependency management"
You're worried that you'll end up sticking out. So, neither /vendor nor /bower_components should be available. You should have one directory available - public_html in which you will have index.php and the assets folder in which all media (css, js, pictures, etc.) will be collected. How to organize this is the second question that Google will answer for you on the request "project collector".
And now, in order:
1) use separately Composer for PHP, and separately Bower
yes
2) You will have to use two different package managers in parallel
yes
3) Then the question is, where to place the PHP and JS files of my project itself? In /vendor and /bower_components?
yes, use the default folders
4) how to organize all this correctly, beautifully and conveniently?
/ .. framework_dirs ..
/vendor
/bower_components
/public_html + assets
/..
+ index.php
it does not have the ability to remove unnecessary ones (for example, leave only 1 jquery.js file from the entire jquery package), then I think that it is better to hide the full folder and deploy only what is needed.

S
Sergey, 2015-11-26
Protko @Fesor

How to properly and optimally use package managers for such a task?

no way, provide an independent application in the form of ready-made builds (compiled tar.gz with all dependencies, deb packages, docker containers).
the main idea is that this "embeddable component" of yours is actually a full-fledged application, the versions of the dependencies of which may well conflict with the project into which it will be integrated. To reduce the number of problems, your application / module / component should be isolated from the main application and simply provide a means for interaction. Based on the task, http api will suit you for example.

Y
yalex1442, 2015-11-26
@yalex1442

Run a git bash-installer (aka updater) which of the input parameters (installation directory, etc.) will do all the work
upd : google showed this
google https://github.com/francoispluchino/composer-asset...
It's better to hang processing via php interpreter by the web server, only a limited number of files. Regarding the vendor folder, it is not recommended to store any configs in them, it’s not scary if they fall into the output of the web server in the form of source code, especially if the copies are open in open turnips

N
Nikolai Antonov, 2016-06-25
@my-nickname

So, in order:
1) go to the apt-get package manager and install node.js
2) then from the npm package manager that comes with the node, install bower
3) if you plan to use sass via compass, then use the apt-get package manager to install ruby with which the gem package manager comes in the box
4) install sass and compass from the gem package manager
5) use the bower package manager to download jquery plugins
6) and lastly for php use the composer package manager

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question