S
S
sp-megamen2018-04-10 11:47:09
PHP
sp-megamen, 2018-04-10 11:47:09

Is it possible to work with package.json using php?

Hello, you need to give the user the ability to load different packages directly from the web muzzle, from the admin panel.
Well, for example, the ability to connect to the site page https://github.com/selectize/selectize.js
In this case, only php is available.
I plan to do in the admin panel, in which the user will specify a link to the repository.
And after saving the page, the engine will use the package.json file to download from this repository.
That is, you need some kind of npm package manager written in php, which would download the necessary files, satisfy the dependencies, put it all in the /public/vendors folder and finally issued tags

Answer the question

In order to leave comments, you need to log in

4 answer(s)
M
Mikhail Osher, 2018-04-10
@miraage

https://unpkg.com/

D
Dmitry Dart, 2018-04-10
@gobananas

In php, you can call an external application or command, for example like this . So, in theory, it can call commands from the admin panel in the console. How safe, correct, etc. is it? that's another question.

A
Anatoly Medvedev, 2018-04-10
@balamyt92


That is, you need some kind of npm package manager written in php,
allowable
no problem as mentioned above
let's say we figured it out
not a problem
what tags? all libraries are different and for each (especially noodles) the approach is different. You can learn what to do and where to connect only from the readme or you can’t find out from anywhere at all, in the luge case there is a build / dest folder or something like that, but again, how to work with this is not very clear. This can only be solved by personally preparing the libraries.

V
Vanik Khachatryan, 2018-04-12
@VaniXac

You can just edit the package via php, since it can work with files, and you just launch the console from the code with the desired command.
In fact, it turns out that you made a homemade web shell for npm))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question