N
N
Nadim Zakirov2020-11-23 17:10:06
PHP
Nadim Zakirov, 2020-11-23 17:10:06

Are there CDNs for PHP libraries?

Are there CDNs for PHP scripts?

For example, if I need a plugin in JavaScript, I take it and quickly connect it from here:
https://cdnjs.com

Is there a similar practice for PHP or does no one do this because of the insecurity of running remote PHP code?

Example
<?php

$code = file_get_contents('https://cdnphp.com/blablabla.php');
eval($code);

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stalker_RED, 2020-11-23
@zkrvndm

composer is an application level package manager for the PHP programming language that provides dependency management tools for a PHP application.
PEAR (an acronym for the English words PHP Extension and Application Repository) is an open source PHP class library distributed through the package manager of the same name. PHP comes standard with the PEAR class management system, which makes it easy to download and update them.
(this is an older and lower level mechanism, but still used on some systems)
This is your example

$code = file_get_contents(' https://cdnphp.com/blablabla.php ');
eval($code);
You can even replace it with include , just don't forget to change the allow_url_include setting .
But in this way, firstly, you will open a potential security hole, and secondly, will it be downloaded every time the script is executed? That is, there will be a delay. It would be logical to save the file locally to some folder. But what if he released a new version? .. And now you are already inventing your own version of the composer.

D
dmitriy, 2020-11-24
@dmitriylanets

JavaScript I need some kind of plugin

you need to build on the goal you are pursuing. For example, if I need some kind of plugin in JavaScript - not an argument, still do not forget php - the server language, and you take practices from the client side as an example.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question