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

single page application

is it possible to create single page application without using any other framework like react , angular? if there is a way, can someone give example?

You can work around https://developer.mozilla.org/en-US/docs/Web/API/History , but in the end you will face challenges that are already solved by frameworks you named :)



43.9k

Hi,

is it possible to create single page application without using any other framework

angular.min.js is 166 Ko of javascript condensed code written and used by a huge community of developers. So ,depending on what you want to achieve:

  • You want advanced features: use an already working js framework
  • Your needs are simple (like: just loading a blog post): you can do that by your own (but jquerry will help you)

in both case you will have to develop in javascript for the frontend and in php for the backend.

edited May '18

Yea there is but it's stupid, Vuejs gziped is only 31kb.



85.5k

there is no magic behaind the curtains it all ends in plain javasctipt. So yes you can

https://vanilla-js.com/

You can say same stuff about php, why use phalcon or any other php freamework when you can do yourself everyhing in plain php?



85.5k
edited May '18

You can initalize your page with the minimum needed for the user and get all user interfaces on demand by ajax call really simply, I do it in all my applications web3D gamelike.
The problem with angular or other framework like it is that creates a lot of watchers which could kill performance and the user consume a lot of the data that he maybe never use.

New angulars are much faster and aren't using a lot of watchers so it doesn't kill performance so much.

Even if its better now, in large applications its a real problem and more in 3D application where javascript is already used in real time by frame to render the scene. Then you can't control the user data consumtion, all data will be loaded and updated constantly for maybe nothing so a lot of server/client performance and bandwith lost.