0 users online. Create an account or sign in to join them.Users

Search

As the topic says: what is the best practice to use symphony as backend for a hybrid mobile app through phonegap.

Is it a matter of producing a json output with xslt and use a javascript template engine for the layout?

This is something that is close to my heart as I've had a side project for a long time that could make use of this!

At the moment, all my data lives in a Symphony install, and then is exposed via pages as JSON. I use XSLT to do this transformation, but I registered some common PHP functions to make dealing with strings a little more bearable (str_replace, strtolower, strtotime). I use a small XSLT helper for JSON, but otherwise it's fairly manual. I wanted full control on the JSON output so this is why I went down this path.

As for Phonegap, this is the part I never got too fully. I have a script that spiders my JSON API and saves all the data as JSON files that I embed into the phonegap template. There's therefore no connectivity inside my application, it solely runs from the package. Why did I do this? My project has a requirement for offline first, so that's why the data is embedded into the Phonegap application. I never got around to the enhancement of this to use this data as a fallback.

If you do go down the same road, I'd recommend at least trying to get live connectivity working. Any data changes result in a total rebuild and deploy of the package, which is a little annoying for typos ;)

Best of luck! Please share what you come up with :)

Thanks Brendo for your thoughts. That fits in my workflow.

The live connectivity is the part I also got the most doubt about.

The live connectivity is the part I also got the most doubt about.

For me it wasn't so much the Symphony side of things, I just wasn't too sure about getting the right permissions for the Phonegap application to be able to use the 'internets'. That said, the Phonegap documentation looks like it's improved since I originally looked into it, so it may be much simplier now.

If it helps, I used Phonegap Build, so literally just made the application with web technologies and zipped it to that service. I haven't had to play around with compiling it myself. This also looks easier these days as well.

If it helps, I used Phonegap Build, so literally just made the application with web technologies and zipped it to that service.

The reason I post the question was that I had playing around with Phonegap Build :-) to discover that compiling was so easy nowadays.

what is the best practice to use symphony as backend for a hybrid mobile app through phonegap. Is it a matter of producing a json output with xslt and use a javascript template engine for the layout?

Pretty much. Symphony's role would just be to provide a vessel for data input and provider for corresponding output in your chosen format — JSON for example. You can setup your endpoints manually as Brendo did for fine-grained control. @iwyg's xml-to-json is a useful utility which has been iteratively enhanced from other releases. API Page makes it even easier and reduces the transformation overhead.

If you want a packaged and distributable 'app' then PhoneGap/Apache Cordova is probably the best option in that you can re-apply your web skills rather than going native (although I'd favour Apache Cordova being the open source fork of PhoneGap following Adobe's acquisition. Although the two are pretty identical at the moment Adobe reserve the right to commercialise PhoneGap as they both continue in different directions).

Does it particular need to be a pacakged 'app' though? With the lines blurring between a packaged mobile app and a web-app I generally see more advantages in sticking as a web-app and skipping the compilation step. Any publications of the app through the AppStore will be subject to their policies and subject to their vetting procedures in their own times as well as the continual re-building. Live testing between devices also becomes harder. You do get the advantage of closer integration with the device API's though if that's a particular requirement.

Ah yes, that last paragraph is a very valid point. I distributed my application solely on Android, and as such sidestepped much of the approval process.

Thanks Ian for your response.

For now I was looking if Symphony could be the backend for an app so it could fit in my 'normal' workflow. I'm convinced it is.

I'm aware that a packed website isn't an app. For me an app have to use some functions dedicated to the device or there must be a good reason for offline use from the data. Apple got indeed some strict rules that it must look and feel like an app. Totally agreed with that.

For now I was looking if Symphony could be the backend for an app so it could fit in my 'normal' workflow. I'm convinced it is.

Definitely. One day it would be awesome to see Symphony providing a native RESTful URL schema. Templates not required. :)

For me an app have to use some functions dedicated to the device or there must be a good reason for offline use from the data.

Service workers are the long term answer to offline-first in the browser. When that day comes it will probably see a lot of currently native apps switching to browser-based alternatives. Facebook, Twitter, etc would have very little need for a native app at that point and many others would be in a similar position.

I'm playing with ionic right now and with the apipage extension everything works great.

The only real problem is session management.

Any plans for a token authentication for the members extension? I guess it would work something like the rest api extension implementation with remote login but for members instead of authors.

  1. The user posts his credentials over https.
  2. If the credentials are good symphony generates a token for that user and sends it back.
  3. The user passes the token on every subsequent request.

Do you think this is a viable strategy for authentication?

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details