yiisoft / demo

Yii 3 demo application
https://www.yiiframework.com/
BSD 3-Clause "New" or "Revised" License
318 stars 133 forks source link

how to add backend for the app? #147

Open TiaNex-Com opened 4 years ago

TiaNex-Com commented 4 years ago

start a new project? any suggestions?

What steps will reproduce the problem?

What is the expected result?

What do you get instead?

Additional info

Q A
Version 1.0.?
PHP version
Operating system
samdark commented 4 years ago

What do you mean by "add backend"?

TiaNex-Com commented 4 years ago

just like the backend of yii2-app-advanced

samdark commented 4 years ago

In a similar way i.e. create another entry point etc. but there's almost no need for it in Yii 3 since it's way more flexible about directory structure.

jasonkovacs-tim commented 3 years ago

@samdark Could you please describe how we might reorganize a large Yii2 advanced app (backend, frontend, console, and single vendor folder) into a directory structure that is recommended for Yii3? I am reviewing https://github.com/yiisoft/app and this demo, but it is not clear what the migration path is from a Yii2 advanced app to Yii3 single app.

Would each of our top level apps sit side-by-side, each using the Yii3 single app directory structure, so that backend and frontend can each have config/ and a public/ entry point? If that is done, would there need to be multiple sets of vendor/ and composer.json for each of our backend and frontend apps? That seems like a lot of redundancy, though flexible.

Also, we rely heavily on the Yii2 concept of modules and routing with a tiered structure: app > modules > controllers. I see in the demo that src/ has Blog/, and the config/routes.php has a Route Group of /blog and several Blog/*Controller entries named specifically. In Yii3 Routing, is there a concept of pattern matching of a URI path part to a src/ subdirectory "module" and Controller without specifically naming them all in routes.php? Could you provide an example of this pattern structure? This is unclear from https://github.com/yiisoft/router. Thank you.

rustamwin commented 3 years ago

We recently added host support to the router, now you can split the admin (aka backend) by specifying the host. For example:

Group::create()->routes(
    // your admin routes here.
)->host('admin.{_host}') // just use FastRoute pattern
jasonkovacs-tim commented 3 years ago

Will documentation be provided for how to manually migrate a former Yii2 advanced application template to a Yii3 single application?

samdark commented 3 years ago

@jasonkovacs-tim eventually.