Mobile and Web API - php

We have a requirement to create an API for IOS , Android and Web App.We have a plan to create the API using PHP and Zend Restful API and the web App using zend MVC.
My Question is
We need to work web app same as like mobile apps. So is it possible to access the REST API from my web MVC in Zend? it is good approach or can i write separate model class for web app?
Help is highly appreciable.
Thanks,

Yes, you can design your web app and your API to consume the same business/services layer. You need separate the services layer well enough and treat your web app controllers and API controllers as consumers of the services layer.
Also please read about Zend's Apigility which will help you do the same with lesser efforts.

Related

API Centric web application in laravel

Recently assigned to a new project where we need to build a api centric web application. Requirement is to build 2 separate projects in Laravel one the has all API's that can be accessed by either web or mobile applications(for future purpose) and other is a web application that uses the API's to work almost all of its function.
Building an API project in Laravel is a easy and lots of tutorials are available about using passport etc. But how do i implement that API to web application.
My major question is how do i setup authentication for web application using api, because its default authentication is model based, or my approach is wrong?
Please suggest ideas, because we are currently in planning phase.
Thanks in advance
Each Laravel Project will be identified as it's own "site" so the only suggestion I would have is if you plan to invoke your APIs via AJAX calls to be wary of Cross-Domain Scripting issues.

How can I integrate authentication between laravel applications?

I'm building a series of web applications to use in a small business. We will be using laravel framework to build these applications. The first app will manage users, authentication and authorization for all future applications.
I have 2 doubts:
Is there some best pratice / model for this auth integration? How can I tell app B that the user is authenticated and has access to it? I want to build different laravel apps in order to make it easier to maintain, but (at least for now) they'll run in the same server.
Is it possible to make this integration with another php, non-laravel app? I have one legacy webapp, I'm trying to write the session data that authenticates it inside my laravel code and redirecting the user to the app, but the session data apparently isn't "persisting".
Thanks in advance.
It sounds like you are building a micro service architecture if you follow this methodology there is no reason your apps or services even have to be written in the same language as long as they and all interact using RESTful services.
More reading:
http://martinfowler.com/articles/microservices.html

Events in PHP slim web services

I am writing a web service in PHP using the Slim framework. I have a web application and a mobile application which uses the web service. My web application posts some data to the web service and web service writes it to a database. But I also wanted the web service to send a notification to my mobile application.
I assume this is some kind of an event based action. How to perform this for PHP slim web services? Or in general, for a PHP web service?
I personally use the symfony2 EventDispatcher component to achieve what you speak of. It's a clean way to, well, implement an event-based architecture. This particular implementation of the mediator pattern can make your code extensible with minimal overhead (and much organization).
Link: http://symfony.com/doc/current/components/event_dispatcher/introduction.html
Note: The EventDispatcher can be used independently of symfony2. The above link contains the packagist link of the component.
Edit: If you are a fan of global variables, you could look into the do_action function in WordPress.
I think there is no easy way to implement a direct event notification from Slim to a mobile device. To do such thing you need to open a socket between device and server so you can send direct notification to the device.
With Slim, the easiest way to achieve what you want is to use the list/queue pattern and tell the device to periodically ping your web service (like every 30 sec) and check if there is something new in the queue.

iOS Application, Website, and Web Service - Should I use a framework?

I am developing an iOS application that will be communicating with a PHP/MySQL web service to send/receive data. My plan is to also have a website that has similar functionality to the iOS application and will also interact with the web service. Should I be using a framework to build this web service (I am thinking about Laravel)? Is it a good idea to have the web service separate from the website?
Thanks.
If you are building a native application and requires connection to your website or collecting info, I suggest you to build you own API to access the data from ios using json.

wso2 developing a frontend store front

I am interested in develop a frontend similar to the WSO2 API Manager's STORE or PUBLISHER applications. The operations I need to implement would be just something like:
show all available proxies services (or published services)
show endpoint of each proxy
What API / libraries should I use in order to do something similar?
Can I build a webapp in php or asp to do that?
many thanks
For the front-end applications of WSO2 API Manager,we have used our inbuilt javascript server-side scripting engine called 'Jaggery'.You can find more info about jaggery from here.
API Manager related back-end functionalities handle through an implemented java API.And its front-end functions handle through javascript/jquery.All the mapping between back-end API Manager related java based functionalities and front-end javascript functionalities handle through this Jaggery scripting engine.
If you view API Publisher/Store source from here, the app directory structure has implemented as a template engine.A blog post related on How to customize the API Publisher/Store front-end apps can be found from here.
Other than that to implement API Publisher/Store front-end html views we have used bootstrap framework as described here.
Thanks;

Categories