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

Phalcon and VueJS

How to use Phalcon and VueJs? I must use Micro of MVC arch for app? if use micro, I not understand where to load JS for frontend, and if I use full mvc there troubles when i split js-code. Example would be wonderful

Vue is frontend, Phalcon is backend, two diffrent things. Just make Vue app, and then Phalcon handle all api and database stuff and that's it.

Of course you can have vue app in phalcon app as well and just render volt view with assets to your js scripts etc no problem there. Same with micro, just add view/assets services and do whatever you want.

I'm working on a Phalcon+VueJS stack project right now, our approach was to build a SPA in VueJS which is served via Phalcon backend through WebSocket (WAMP Crossbar.io) requests. There is no ready solution, you'll have to implement it on your own.

I would use webpack for getting vuejs running. There is a lot of tutorials about this combination and in my experience you should develope SPAs seperate from your backend. Since Webpack has a configurable development server built in you can start out with less dependencies. Wojciech Ślawski said these are two very different parts of your applicaiton.

I would reccomend building this initially with a simple template. You are not required to use micro, which is for API layers primarily. In a modern app you probably will not have one Single Page Application(SPA) you will have pages which serve front end assets like VueJS and some that rely on traditional PHP. A Simple MVC project will serve these needs best.

edited Mar '18

I agree with Paul, you would need to use an enigne like webpack or browserify/gulp that helps maintain your *.vue files and does the conversion to javascript.

I wrote an article that descrbes these issues, as I found little help when integrating these applications in their advacend form. https://blog.antsand.com/singlepost/index/5619/How-to-integrate-php-Phalcon-and-Vue.js-components-(*.vue-files

You dont have to complicate things. Use JSON as your data object and send data between vue and phalcon using AJAX calls.

Also wrote an article on how to get started with code examples. Once you structure your code base right, it is easier to design your application. https://blog.antsand.com/singlepost/index/5629/How-to-get-started-integrating-php-Phalcon-and-*.vue-components-with-code-examples

edited Mar '18

Actually, that is what i'm doing right now. I'm using phalcon in back side and vue + vuetify front side. I'm using ajax (vue axios plugin) to communicating between them. I've just changed default delimiter of vue. It's working like a charm.

Thanks to the community..