We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

programmer

I´m considering Phalcon for a large project, actually redevelopment. I need to know if Phalcon is stateful.

There are many important projects running with phalcon without any problem

They are currently working hard on the full support of PHP 7.3

If it is a public access project, share it with us. Good luck

edited Nov '18

What do you mean by 'stateful'?

By itself Phalcon is a PHP framework running over HTTP, which is stateless. You do have built-in support for sessions, but i wouldn't call that stateful.

We are using Phalcon micro for the backend of WebSocket enabled SPA sites, so it is definitely good for modern patterns and technologies, but that's (WS) not out-of-the-box.

Perhaps he ment stable? :)

oh, that would make more sense :D

Perhaps he ment stable? :)



1.1k

No I meant ¨stateful¨. That is, does the framework retain the values stored in varibles from one post to the next of the same form by the same user? I´m quite aware that http web pages are naturally stateless but, many frameworks retain state of a form and its controller. So, for example, if a page is sent to the user and, included on that page is an ajax post back, will Phalcon have retained all the values of all the variables in the controller or would I have to have saved them myself in session varibles?

Phalcon does not provide an automatic stateful mechanism.

You would have to create your own logic to preserve the user values, but that's trivial using the session store.

Agree with Lajos, that's super trivial... :)

I would suggest to make a meeting with your team and see what is valuable for your project and then select a framework.



1.1k

Thanks for your replies. Since the project is quite large (about 1 million lines of code), it´s not so trivial.

If you're looking for a fully featured framework that does a lot of the light lifting for you, Phalcon might not be your best choice. Laravel tends to provide more scaffolding functionality. Phalcon is more like a very fully feautured toolkit. Using Phalcon you can build pretty much anything, and have it run lightning fast. But Phalcon just provides tools that you have to use to build a project.



1.1k
edited Dec '18

Here's my problem...

I have a very large business application (mfg shop floor mgmt, with full acctg), which includes several hundred thousand lines of code (PHP). It's currently writting using the QCubed (QCodo), which is a little slow. The main advantage it has IS NOT scaffolding, although it is included. The main advantage is, it retains form (controller) state. It allows that only updated fields are returned to the server via an Ajax call and the form (controller) has retained the original state of the form and updates the values posted. This would be trivial, if the form had only a few fields but, many of my pages have hundreds of variable fields, not to mention local variables that are not included in form itself. QCubed manages all that out of the box. I'm looking for the same functionality in Phalcon. If it exists, that would be great and it would mean Phalcon would be the obvious choice for redeveloping my application.

So, my question is, does Phalcon provide this functionality?



1.1k

So, after going through the documentation, I discovered Phalcon objects will maintain their state (stateful) using $this->persistent... This is assuming I understand it correctly, of course.

So, after going through the documentation, I discovered Phalcon objects will maintain their state (stateful) using $this->persistent... This is assuming I understand it correctly, of course.

Just make sure to use:

use \Phalcon\Registry as RegistryBag;

$di->setShared('persistent', function(){
    return new RegistryBag();
});


1.1k

Thank you Jonathon. I aprpeciate the guidance very much!