Answer the question
In order to leave comments, you need to log in
How to host an API in YII2?
Standard structure
| project
| frontend
| backend
| index.php
Answer the question
In order to leave comments, you need to log in
Copy the backend folder, rename it to api, edit the config and that's it, api is now a separate application with its own config. For full feng shui, take api to a subdomain.
but, index.php is on the same level as backend, etc. this is bad practice, rather like this:
-project
----frontend
----common
----backend
----api
----public_html (public folder accessible from the web)
--------css
--------images
--------index.php
--------admin(admin folder)
------------css
---- --------index.php
--------api (api subdomain folder)
------------index.php (api entry point)
Create a module.
www.yiiframework.com/doc-2.0/guide-structure-modul...
| project
| front end
| backend
| API
| api2
| api3
| index.php
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question