A
A
Alixx2018-12-05 19:17:34
Mobile development
Alixx, 2018-12-05 19:17:34

Mobile client for a site in php (laravel)?

There is a website:
backend - php (namely laravel 5.4) database
- mysql
web server - apache
frontend - html (blade templates), css, js, ajax
And also in the future there will be redis (for chat and not only), comet. The frontend has a lot of css / js animation (+ timers), pictures, a lot of ajax requests for various calculations (made on laravel). In general, not just the output of pages with information, but an engine with a web interface. Now there is a need for a mobile interface - a mobile client (both android and ios). The mobile version should be very different from the web version - gestures will be added, the arrangement of elements will change, pictures will be different, etc.
The question is, is it possible to add an existing mobile client to all of the above? So that the engine also remains on php? Is it easy to separate where requests come from and where messages go - to the browser or to the mobile client? Or does it have its own engine for the web (on php), and for mobile phones its own (on what, by the way?)?
PS: I have experience with creating applications in C ++ for windows, but I didn’t have to work with mobile phones at all.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
illuzor, 2018-12-05
@iLLuzor

The client should not care at all what the server is written on. All he needs to know is how to send requests and in what form the answers come.
Write a separate API and work through it.

O
Oleg, 2018-12-06
@402d

rough analogy. on the main domain lies only statics.
PHP runs on the api subdomain. From the script, you can only give json .
Implement crud to manipulate data.
Controllers need to receive input parameters via REQUEST_URI and/or $_GET and $_POST, $_FILE forget about them. Java-native requests are handled as above. Those. for the site, the front is html,js.css - i.e. all rendering of the interface and received data is the task of the front / application. And the backend only provides data. analogue of a request from an application in javascript

var json = JSON.stringify(cloneCommand);

        // готовим ajax запрос
        var r = new XMLHttpRequest();
        r.open("POST", connection.urlServer + 'Execute/sync', true);
        r.responseType = 'json';
        r.setRequestHeader("Authorization", connection.auth);
        r.onload = function () {
            var json = r.response;
            // костыль для IE11
            if ('string' === typeof(json)) {
                json = JSON.parse(/** @type string */json);
            }
            successHook(json);
        };
        r.onerror = function () {
            errorHook(r, 'ajax error');
        };
        r.send(json);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question