Refactoring Slow Forms Using PHP Generators and Event Streams

Originally published at: https://pressbooks.org/blog/2018/11/12/refactoring-slow-forms-using-php-generators-and-event-streams/

The form will still be slow but the user experience will be better. The user will see a progress bar and see status updates in real time. The idea is to refactor something like this: /** * A task that takes way too loooooooooooooooooooooooong… */ function task() { step1(); step2(); step3(); // step100(); } Into…

3 Likes

This is awesome…May be similar progress bar might require while importing books. The site looks like frozen while importing huge content of books, but when you refresh, the next step of import option appears.