So, I've been taking a course on Vue.js.
Before, I've made small projects where I've used jQuery to make ajax calls to local PHP files, that then connects to a MySQL database in phpmyadmin. Just a simple CRUD application.
Using Vue, I'm struggling to figure out how to connect with PHP and MySQL in a similar way. The course has gone into the Vue CLI and using webpack to set up a project and then import components and so on. I understand when using "run dev" it sets up a node server and displays the app. XXAMP, which I've used before, just loads a bank page.
Is there a way I can harness the full extent of Vue but used with a locally hosted PHP / MySQL backend? If not, what technology do I need to use / learn for a full stack app?
I suggest you step a bit out of your comfort zone for this one.
Doing it basic like that via XAMPP, etc, is fine, but why not use something like Laravel together with Vue. Even officially the frameworks collaborate, and there are lots of examples of combined usage.
Also, Laravel makes sure that it sets you up with a local development environment without much fuss, and also utilizes PHP's own built-in development server, rendering your need for XAMPP obsolete. For starters check out this tutorial.
Good luck and have fun!
Related
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.
I've developed a reporting application in PHP. The application is built with HTML, CSS, javascript libraries, charting library(Highcharts) & MySQL to store data. The user chooses some options in the front end & clicks a "Submit button". Then the PHP layer executes a bunch of required SQLs & sends json result back to the UI where the charting & data tables are drawn.
The requirement now is, to be able to plug in a big data solution, Apache Spark to the existing application. I've been researching for the last 2 weeks on if I can in someway plug in the PHP application using REST API or some sort of Spark SQL driver to connect to Spark SQL server & execute the same set of SQLs that I have now, on the Spark SQL. I haven't hit a solution yet. I've now started researching on java based technologies such as Spring, others such as Angularjs, Nodejs other MVC frameworks to rewrite the project from scratch. I'm not a big fan of java development as I'm not a hardcore developer.(I build some handy tools to get things done).
I did read this - https://cwiki.apache.org/confluence/display/Hive/HiveClient#HiveClient-PHP, but looks like it's for a standalone spark installation. I'm dealing with a huge cluster in my case.
I'd highly appreciate any direction here please.
Yes it can be done by using a hive context and spark sql thrift server in spark application.
you can run your spark application and do all the processing. After processing if you are using a Data frame you have to just register it as a temporary table.
Now you can start a thrift server from the spark application.
After starting the thrift server you can query the temporary table and get the results and insights using proper jdbc divers in PHP.
refer the link below for more details
https://medium.com/#anicolaspp/apache-spark-as-a-distributed-sql-engine-4373e254e0f9#.ekc3cs28u
This might not what you want. But if you consider using Scala to build it. Here is one possible solution.
Having a web server which either using Spark standalone or connect to a cluster.
Using spark-highcharts to plot Spark DataFrame with highcharts
Writing some code which accept some option from web and let it execute in the backend web server.
Are you using any specific cluster, like cloudera or hortonworks?
In case of Cloudera, you should use Impala and corresponding JDBC drivers.
In HDP, you should use Spark Thrift Server, with corresponding JDBC drivers.
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.
Actually, I am working on a project with Laravel5 (laravel.com)
someone who is working on another project with SailsJS (sailsjs.org) asked me why I am still using PHP. I should work with nodejs (sails), because PHP would be a language would be going to die.
Well, what's better to use for the future.
Both are MVC frameworks
on both you can code views with Jade (see jade-lang.org)
on both you can use any database.
on both you can easily install modules (composer / npm for the backend), bower for the frontend
What's better - and an important aspect - which framework creates responds faster?
As a technical guy, i would suggest you to use sails over laravel. Its not because PHP is going to die(and it will not happen).
As far as i know, anything built on javascript would be faster.
There are lot of advantages in sails like sockets are very easy to implement so on.
When it comes to disadvantage, its only with DOCUMENTATION. For a beginner, it would become little difficult to grasp all the things.
From PHP (Synchronous) to sails(Assynchronous), it will take some time to get familiar with sails.
Make sure you understand the basics of node.js very well before you start with sails.
For more references, see this , this and this
PHP is never going to die, Choosing a technology stack all depends on application & available resource, If you have expertise in php then you will obviously take longer time building app in nodejs/sails.
I have worked on both frameworks (sailsjs & larave 5.2) and for my new project i will go with laravel because:
Laravel is pretty mature framework (was founded in 2011 and has 9K contributors)
It got builtin support for most of things like migraters, seeders, queuing system and templates.
Documentation is very good.
lots of 3rd party integration, you can integrate it with s3-buckets, dropbox any email service provider and backup services in few minutes. complete list of integrations
Disadvantage of laravel:
Socket support is poor, but you can do socket part in nodejs, and can
bridge that using REST APIS.
Mongodb support is not good.
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