Best way to integrate a react fuse template in php codeigniter - php

We have an app using the Codeigniter framework, and we are trying to connect a Fuse React Template Fuse React to be used as the view of the application.
Which way would be the best way to integrate the react build into the php code base?
We first thought that it would be easy to just use a react_view_controller. Similar to this:
How to integrate Reactjs frontend with php codeigniter application on apache server?
but it seemed confusing to import the files into a script one by one since they are coming from a well structured template.
Then we thought we will build out the production build and mount that into the php codebase.
How do we configure php to look at the react-build files?
Anyone have any resources I could look up?

Related

Vue.js (CLI) + PHP

I'm relatively new to practical web development, so I apologize if the question is stupid. The crux of the problem: I only want to use Vue on the front end of the site, and on the back I am using a PHP framework (or not a framework, it doesn't matter). Connecting Vue to every page via a CDN seems to be wrong to me. I didn't quite understand how the CLI works, does it generate some kind of static files (like a compiler), or does it definitely need Node? And did I understand correctly that I can't use things like Vuex and vue-router without node.js? Thank you in advance!
VueJS and vue-router are totally independent JavaScript framework and router, you do not need NodeJs to use them, you might get confused after using npm but npm is just a package manager, using it is a matter of choice.
The ClI or currently #vue/cli is just a command line that you can use to create new projects and control them, run them etc, using it isn't required when using vue trough a CDN.
About PHP:
There are a lot of ways to use VueJs in PHP but the most convenient one would be creating a PHP API in the back-end and a normal Vue and Axios app in the front-end, this approach is the one you should get used too because its easily implemented in other languages and even PHP frameworks, for example WordPress.

App development setup with PHP and Vue.js

I am new to Nextcloud app development and would like to create a simple app to play around. I saw that some apps are made with Vue.js, so I’m asking if there is a guide out there?
I generated an app skeleton and played around with the PHP templates but unfortunately I don’t know PHP and would like to create a Vue.js project into this existing demo app.
I found some premade Vue components for Nextcloud
https://github.com/nextcloud/nextcloud-vue
but no step by step guide on how to setup the Vue project after creating the skeleton app. I just saw that the Nextcloud app Tasks is also using Vue.js within the PHP code:
https://github.com/nextcloud/tasks
Thanks a lot for help.
I've looked at the repository you mentioned and it's fairly easy to setup, the question is what would you deserve after setup? If you clone the repository you have something like a 'working copy' of the plugin. But this Plugin needs to be build and the resulting package needs to be copied to right location at the nextcloud server (or maybe you have to install the package over frontend). This is some type of plugin and not a full web application which could run standalone, as I understood.
It's not like you said:
Nextcloud app Tasks is also using Vue.js within the PHP code
It's more like PHP is used for Backend and Vue is used for Frontend, these two 'projects' are completely independent from each other (PHP is backend and Vue is frontend there are no direct dependencies). Just create your Vue application (after build you will have an index.html and several js and css files) these files have to be available from browser. Then your applications entrypoint is the index.html. For PHP: You will just define Interfaces and Routes here which will give you the possibility to interact with the serverside. Then later to deploy your plugin, you have to package it in the format nextcloud needs. You can read from Makefile in the Tasks repository what happens if package is created.
I think a good starting point for you would be: https://docs.nextcloud.com/server/15/developer_manual/app/tutorial.html

SAPUI5 For the UI and LARAVEL for backoffice

I have to begin a new project and that's 2 years ago that I'm working on SAPUI5, But for severals reasons I have to use the Laravel 5.1 Framework to handle the database logic and controller to get and put data from and to the database.
I appreciate the power of SAPUI5 and I would like to use it for the front-end of my app.
My question is : It is possible to handle a server application with those two technologies?
My second question is : Which hosting I have to choose, because that my client want a kind of desktop app, and for this I thought to use node webkit package. And for that i have to launch a node server. In my goDaddy shared hosting i don't have this possibility.
Thank you for your help!
You can definitely combine Laravel as back-end technology with SAPUI5/OpenUI5 as front-end technology. As Laravel provides the front-end with restful services, you're probably best-off leveraging the JSONModel in your UI5 application.
Laravel is a PHP framework, so you'll need to look for a PHP host. If a host is capable of running PHP, it is also able to serve the static UI5 content.
If you want to package your app as a desktop application, NW.js will work, but Electron will do the job too. A very nice comparison between the two frameworks can be found here: http://tangiblejs.com/posts/nw-js-electron-compared.
Please do note that both frameworks turn your application into a desktop application and will run on the desktop. You won't need to find a server that runs node.js. You do need a server that runs PHP for your back-end Laravel logic.

Mixing CodeIgninter (PHP) with Backbonejs

I just want to ask, does it make sense to use both a PHP backend MVC structure, mixed with a front end js MVC structure?
My question arises from building a web application in CodeIgniter, I've begun working with websockets and nodejs so a lot of my interactions to the front end don't even touch php. Currently though the only way to change content in my database is to go through CI via ajax calls.
Is there any advice and how to create and maintain both MVC structures? or should this be avoided.
As you already said: CodeIgniter is a MVC framework. As you're using BackboneJS you won't need the VIEW-part of CI and the MODEL-part won't be needed that much.
You could use CodeIgniter as a simple API backend that handles as a middleman between your frontend and the database (there are very good xmlrpc libraries for CI out there!) or you could go for a REST-specific framework like Recess (http://www.recessframework.org/), try this: https://stackoverflow.com/questions/238125/best-framework-for-php-and-creation-of-restful-based-web-services
Short answer: your php-backend would just serve as a API-provider which is used by BackboneJS, so you could use any framework as long as it fits your needs - and CodeIgniter seems to do that.
Tip: you can just delete the libraries and helpers from CodeIgniter that you won't need for you API.

Connect appengine with cakephp

I'm thinking in create a webapplication with cakephp but consuming python's appengine webservice. But, to install cakephp etc, I need to configure the database. Appengine uses another kind of datastorage, with is different from mysql, etc.
I was thinking in store the data in appengine, and using the python webservices, and with the cakephp application comunicating with the webservice, for insert and retrieve data.
Is there any good resource for this, or is it unpossible.
Obs: also opened for a possibility for developing the webapplicaiton completely in python running in appengine. If anyone has a good resource.
Thanks.
I think that you should try different solution: http://aws.amazon.com/simpledb/
It appears that CakePHP is a MVC framework that's very similar to django, which is included in app engine for python. I'm not sure why you would want to store your data in google app engine, unless you're dealing with an extremely large amount of data, in which case you're likely comfortable enough working in python to just make the app work entirely on GAE.
See the official docs for more info:
http://code.google.com/appengine/docs/python/overview.html
http://code.google.com/appengine/articles/django.html
What you can do is run your CakePHP app on a standard LAMP web host and access the GAE Data Store through a REST or RPC web service. This isn't such a bad idea if you already have a CakePHP front-end that deals with RPCs in the backend, but if your Cake app stores all it's Models in MySQL it could take considerable effort to adapt it.CakePHP Models abstract their storage method using the DataSource class. You might be able to find a DataSource class that uses REST or RPC. However, if you don't have a very considerable investment in CakePHP Controllers and Templates I would suggest simply building your app entirely in GAE
You can not run PHP on GAE. If you run PHP somewhere, it is a bad architecture to go over the internet for your data. It will be slooooow and a nightmare to develop in.
You should store your data where you run your php, unless you must have a distributed, globally scaling architecture, which afaiu not the case.
There's a detailed tutorial on getting CakePHP up using the PHP runtime that Google recently announced. http://aymanrb.blogspot.com/2013/05/cakephp-deployment-on-google-app-engine.html

Categories