Nice, lightweight infrastructure without mvc php for backbone.js web application

I am developing a JS web application with requirejs, backbone.js, underscore.js and jquery.
At work, my server is the jboss application server.
My views are templates (static html files) that are served by the tomcat jboss part and integrated into the interface using the underscore.js template.
Therefore, I do not need to generate VIEW on the server side.
With the exception of the aforementioned static file provided by tomcat (html and js files), I need a jboss backend only to retrieve data (session beans, which receive data through jpa from the database and return it as json).
Now I also want to run the web application at home in my free time.
In the interface area I will use the same library stack, but in the backend I want to use php.
Php on the backend is cheap, you can easily find a good, inexpensive php + mysql provider.
On the backend, I am looking for a solution that usually looks like my work environment: I want php to only give me part of the model, only data from the database. All other parts (viewing templates, js files) come from the apache static file service.
And I want the php lightweight structure to help me achieve this (NO MVC). I already spent a lot of time finding a solution, but was not really successful.
I have been working with the zend platform for a long time:
I know this structure can be used in a non-mvc way. I have written several examples that use it only this way. But I'm not happy with the zend. He is too big and slow.

My question is that backbone.js web application developers have a php server:

What backend solution do you use to get models and collections from the server. What experience did you have with him?

UPDATE:
Thank you for your responses. Now I have found a promising microframe project called "slimphp".

+6
source share
2 answers

It looks like you are looking for microcards; something lightweight that provides the features you are looking for without interfering with them.

One microcard I am familiar with is Silex , which is built on some of the same components that are used by the Symfony2 framework . I'm not quite sure what covers all your β€œno MVC” clauses, but just creating an API that interacts with your database and processes / provides JSON for use with the backbone, passing patterns and other non-essential (from your app pointpoint) completely.

Silex comes with a provider for the Doctrine database abstraction layer (documentation here ) that will handle your database interactions, as well as the cookbook tutorial for accepting the body of the JSON request , so that receiving JSON data in a message, for example, is easily handled by the framework.

+6
source

I used slim php for a full backend with the same vend interface. I combined it with Paris and Idiorm http://j4mie.github.com/idiormandparis/ , which helped speed up the database.

Nettuts has released a tutorial with all of these technologies here http://net.tutsplus.com/tutorials/php/rapid-application-prototyping-in-php-using-a-micro-framework/ . You can ignore part of the branch.

Hit me on github (johnnygreen) or twitter (@bemusedjohnny) if you have questions. On the way you hit a lot of snags. Good luck.

+5
source

Source: https://habr.com/ru/post/909315/


All Articles