phalcon / cphalcon

High performance, full-stack PHP framework delivered as a C extension.
https://phalcon.io
BSD 3-Clause "New" or "Revised" License
10.78k stars 1.96k forks source link

PHP 8.0 support #15186

Closed drmuey closed 3 years ago

drmuey commented 3 years ago

Hello,

Are you all looking at PHP 8.0 support?

If so do you have a ball park ETA?

Thanks!

sinbadxiii commented 3 years ago

I am also interested in php 8 support

Jeckerson commented 3 years ago

Phalcon v4.1 only is supported with 7.2, 7.3 and 7.4 PHP versions. PHP8 will be supported since Phalcon v5.0 and v4.2.

Phalcon 5 will be in PHP native, here is the official repository - https://github.com/phalcon/phalcon ETA - end of 2020 ~ beginning of 2021.

Jeckerson commented 3 years ago

Related

Jeckerson commented 3 years ago

Related

ghost commented 3 years ago

Yeah, I would rather wait a year or two but have native php Phalcon 5 more complete and PHP8 ready. Good to see the new official v5 repo! Keep up the good work guys! You are all amazing!

Jeckerson commented 3 years ago

Related

Jeckerson commented 3 years ago

Related

Jeckerson commented 3 years ago

@firemanhu @AnthoniG For any demagogic questions please use - Discussions

Jeckerson commented 3 years ago

image

First local run of unit tests with PHP8

fakharak commented 3 years ago

No JIT Compiler, specially PHP 8+, will ever be able to compete the performance of Compiled code, and having HMVC (Modular) Architecture (code) in compiled format should be seen as wisdom. Phalcon Micro makes a good usecase for Micro-services Architecture. Zephir, and Phalcon (C compiled) must be supported for PHP 8.0. just as we have Swoole (PHP extension in C++) ready for PHP 8.0.

fakharak commented 3 years ago

On TechEmpower (Link below), Phalcon has been tested using PHP 7.4, whereas Laravel 8 has been tested using PHP 8.0. Phalcon (on PHP 7.4) is still 4.7 (471%) times faster than "Laravel" (even though running on PHP 8.0" with JIT)

Check Rank 326 for Phalcon, and Laravel Rank is 388 (Phalcon Micro is even betetr as on Rank 277) https://www.techempower.com/benchmarks/

Note: DrogonCore (C++ Micro Framework) is on on top in throughput (request per seconds) as utilizing 100% resources efficiently. I was also thinking on the idea if Zephir / Phalcon Micro transpile PHP code to DrogonCore (or C++ 14/17) ? (You guys are expert and hands on with C++, so may be that will be relatievly easy for you. I have seen DrogonCore code it looks similar to PHP / Phalcon Micro).

Conclusion: Supporting CPhalcon (compiled HMVC / Micro Architecture) for PHP 8.0 is rational (makes sense).

lcdennison commented 3 years ago

Is there a rough ETA for Phalcon 4.2.0 with PHP8 support? I understand not setting a specific date or even date range, but it would be helpful to my organization if we could know whether we should be expecting something like "within the next couple weeks" or "in 3-6 months from now" type of thing. We are trying to make decisions between building projects in 4.1.x on PHP7.4 now and then upgrading later, or holding off for 4.2.0 with PHP8. Obviously we'd prefer the latter because starting with PHP8 is great, but it depends on how long we'd need to wait. So just having an idea of what's realistic at a high level from the Phalcon team would be super helpful, even if it's going to be far delayed, no worries.

Jeckerson commented 3 years ago

@ldennison 2-3 weeks, might be earlier with some alpha or beta. Most of work already done, organization moments and decisions left.

If you really need it now, you can try to compile by yourself the extension from current branch - https://github.com/phalcon/cphalcon/tree/php-8-compile-test and try to test against your code.

One of decisions is that, we will probably launch v5 instead of v4.2, because we fixed some methods interfaces due bug in Zephir. But in most, next version will be almost the same as v4.1, only PHP versions support shifting to PHP >= 7.4.

lcdennison commented 3 years ago

@Jeckerson Awesome, thanks for the update. I may try to compile when I get a chance, thanks for that.

Regarding launching v5 instead of v4.2, does that mean that the new version that supports PHP8 will be in native PHP and not the C/Zephir extension? It's not a pressing question, I'm just curious.

Jeckerson commented 3 years ago

@ldennison

Regarding launching v5 instead of v4.2, does that mean that the new version that supports PHP8 will be in native PHP and not the C/Zephir extension? It's not a pressing question, I'm just curious.

Phalcon v5.0 - extension Phalcon v6.0 - via composer

As I already told, due changes in interfaces we can't broke semver, so we shift from 4.2 to 5.0, and from 5.0 to 6.0.

lcdennison commented 3 years ago

@Jeckerson Got it, that makes sense. Thanks for the information.

lcdennison commented 3 years ago

For what it's worth, I tried compiling the php-8-compile-test branch against PHP 8.0.3 on Debian. I got the following following exception:

[2021-03-19T08:49:00+00:00][error] Fatal exception (Phalcon\Di\Exception) thrown during application request execution: Call to undefined method or service 'getroutepaths'
[2021-03-19T08:49:00+00:00][debug] #0 [internal function]: Phalcon\Di->__call('getroutepaths', Array)
#1 [internal function]: Phalcon\Mvc\Router\Route->reConfigure('/(.*)', Array)
#2 [internal function]: Phalcon\Mvc\Router\Route->__construct('/(.*)', Array, NULL)
#3 /var/www/html/public/index.php(121): Phalcon\Mvc\Router->add('/(.*)', Array)
... (unrelated stacktrace items)

However, I also had to do some weird things to get my Debian container to install the php8.0-dev package for compiling Phalcon, so it's possible something is wrong there unrelated to Phalcon. It seems a Phalcon-specific message but who knows. Just wanted to post my result in case it's helpful to anyone.

Jeckerson commented 3 years ago

@ldennison Here is example that I used for TechFramework benchmarks

https://gist.github.com/Jeckerson/57920de3247a140033949d5af5c153ab

Jeckerson commented 3 years ago

Related #15357

lcdennison commented 3 years ago

What's the process to install/compile the 5.0.0-alpha.1 version? I tried using the process at https://docs.phalcon.io/4.0/en/installation#compile-from-sources (using both master and tags/v5.0.0-alpha.1), but I'm getting issues with that method on my local Debian setup.

Normally I'd do a simple install via Remi repo, but the updated Phalcon package is not available there yet because it's not on PECL.

Jeckerson commented 3 years ago

@ldennison Hello, you will need latest 0.13.x version of Zephir and PSR extension installed, after that clone project and use this commands:

php zephir compile

Fast check if it was compiled:

php -d extension=ext/modules/phalcon.so -r echo "Phalcon\Version::get();"

Then install extension globally:

php zephir install

And after that check if it was installed:

php --ri phalcon

In case you are in Windows, Win dll's will be available since next release.

ghost commented 3 years ago

Will 4.2 be Zephir/C?

niden commented 3 years ago

I do not think there will be a 4.2.x.

4.1.x is a PHP extension 5.x is also a PHP extension

6.x is native PHP

fakharak commented 3 years ago

Is there any updated ETA for 4.1.x and / or 5.x ?

What are expectations related to the performance difference between cphalcon (5.x) and PHP-native (6.x) implementations?

niden commented 3 years ago

Is there any updated ETA for 4.1.x and / or 5.x ?

What are expectations related to the performance difference between cphalcon (5.x) and PHP-native (6.x) implementations?

We have mentioned this before in blog posts as well as community hangouts:

4.x is maintained only for security updates. Most likely we will not release any more 5.x is our main focus since this is kind of a "fix a lot of interfaces" version. This is our main focus and it does support PHP 8. I am running alpha3 on a project right now.

6.x (native) will start after we have v5 stable and out the door.

There will be an impact in performance for sure. v6 will feature benchmarks which will allow us to see bottlenecks. For those bottleneck areas we will also have an extension (or extensions) available for people that want more performance. v6 will detect if the extension is loaded and use it.

Jeckerson commented 3 years ago

PHP 8.0 support depends on Zephir, which already supports it since version 0.13.x. Closing.