Yii Framework Forum

How to use Yii2 as API consumer (No DB connection)

(ajithcr4u) #1

Hello All,

Good Day!

I am developing a Yii2 Application. This will be pure API consumer application. No database connectivity.
Login API accepts user name and password, and returns oAuth Token. This token is used for subsequent operations.

  1. What should be the standards for this kind of implementations?
  2. What is the correct way to save the login session?
  3. Which Library i can make use of for the API requests?

(Alirz23) #2

Hello there,

Yii provides a package for http (yii2-httpclient) you can create a custom component around the client as a wrapper.

As for the implementation goes there are many ways If you don’t wanna deal with the complexity of database I would suggest you store your token in session and send it along with subsequent requests.