[php-src] Issue #13966: This is my personal perception, a question and a suggestion, and it may not be correct.

From: Date: Mon, 15 Apr 2024 11:24:24 +0000
Subject: [php-src] Issue #13966: This is my personal perception, a question and a suggestion, and it may not be correct.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-246760@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/13966 Author: wheakerd ### Description I'm designing a framework, but I've encountered some problems: $cat = \App\Service\IndexService::class;  $anonymousService = new class() extends \App\Service\IndexService {}; This is feasible, but I want to be more flexible, such as:  $anonymousService = new class() extends $cat {};  The parameters of this class are restricted and must require the use of \App\Service\IndexService attributes. But in this way, I cannot dynamically use anonymous functions to dynamically proxy in order to perform some proxy operations, such as a long polling mysql connection.  So, in the current version, there are only a few ways I can choose, such as trait file caching proxy, or anonymous class inheritance through the eval function. As we all know, the eval function is not safe. This safety depends on the code written by the developer and his or her own logical awareness and level of cognition.  I desperately need functionality, and this should make our future releases better.  This is my second question, as follows:  A PHP installation can use PHP's built-in functions and built-in classes. If I use some other functions, and this is not PHP's built-in function, then I need to install more extensions. Is this not reasonable enough? I need to install the extension and solve the third-party libraries required for the extension. At some point, I need to specify the location where the third-party library is installed. If this third-party library does not exist in the Linux system software source. I'm not sure if there will be problems with third-party libraries, like the XZ Utils backdoor incident some time ago. At the same time, when I use Java, when I need a MySQL function, I only need to download the MySQL jar package through Maven to connect to MySQL. When I use PHP, I need to compile and install one. extension, or introduce a dynamic extension. I don't have any way to use php language like java to achieve this function.  There is a solution for this. I need to spend time learning and implementing it in C language while knowing the PHP language, and then implement it with the help of FFI extension.  In future versions, can I use the PHP language to encapsulate it into phar or source code to implement an extended function? If so, how long do we need to wait? Some people say that php is the best language in the world. But should we also accept our own shortcomings and the advantages of other languages? Do we really have to maintain CGI and web server modules (such as mod_php, php-fpm, etc.), Embed SAPI and FastCGI mode? Nowadays, there are many ways to achieve this, such as SWOOLE, etc. Would it change faster if it was only for CLI mode? In 2023, any language will show an upward trend in the language rankings, but PHP has dropped to 11 or even lower. PHP jobs are declining rapidly in my country, so I still have to admit the truth.Now, should I give up php and switch careers or continue to wait.

« previous php.bugs (#246760) next »